Monday, March 09, 2020

Setting up and configuring wol and rpc remote shutdown for windows clients

If your looking for an inexpensive way to setup an automatic turning on and shutting off of your windows computer systems, using WOL and RPC are an excellent way to do that, you can even setup a Linux server for controlling the timing for turning the systems on/off and it isn’t too difficult to manage. I will do a post soon about setting up a linux server to run WOL and RPC Shutdown scripts. If your looking to set one up the quick and dirty version is:

Requirements SAMBA, Windows Admin and Password, Linux Admin and Password

Put startup/shutdown scripts in /etc/cron.daily

Startup
sudo -i -u $linuxAdminUser -p $password wakeonlan -i $IPADDRESS $MACADDRESS

Shutdown
sudo -i -u $linuxAdminUser -p $password net rpc shutdown -I $IPADDRESS -U $WindowsADM%$password -t 1 -f

Use Crontab to setup scheduling


Crontab schedule

For more information about crontab, you can visit this link about crontab


Here are the break down of the examples above


00 12 * * 5 user command

at minute 00, hour 12, * - no value (day of the month), * - no value (month), 5  the fifth day of the week (friday), user to run the script and script to run.

So the following example "00 12 * * 5 root /etc/cron.daily/shutdown.sh"

at minute 00, at 12 pm, on friday run as root the script shutdown in /etc/cron.daily


Setting up the Windows 10 Client


For setting up WOL/RPC shutdown, you have to have your windows clients prepped with the proper firewall rules and user accounts for privileged access.


  • An administrator account (not called administrator as windows 10 upgrades disables this with each update)
  • RPC and Remote Access Firewall Rules Allowing (I also allow ICMP and Ping) for remote management with services such as lansweeper and FOG
  • Updated Intel network driver

One thing I have noticed recently is that the manufacturer driver doesn’t seem to work with WOL.  Working with some Lenovo m93 and m900 series and and HP {put hp model here} doing a full windows reinstall/reset breaks WOL.  Even getting an up-to-date manufacturer driver WOL doesn’t seem to work which is extremely odd. A major difference I can account for this is the update to the intel proset tools for their network driver which brings a GUI interface back to add and remove VLANs to Windows 10.

Nic Driver settings to enable WOL in Windows 10

Enable WOL in Windows 10.  In Windows 7 unchecking the computer to turn off the device would leave the device on but in windows 10 it disables all power management and turns it off.  For WOL to work you have to enable "Only allow a magic packet to wake the computer option"

Wake on Link Settings - Disabled


Wake on Magic Packet - Endabled


Wake on Pattern Match - Enabled



Wait for Link - Auto

Even with these settings being enabled and no errors WOL would not go.  I had S3, S4 and S5 enabled in the bios, which would enable WOL to work, but when I send the WOL packet the system stays off.



Version 25 of the Intel network driver and proset tools


Intel Proset software and drivers


Adapter driver Options


Teaming and Vlans
Once I updated the driver to version 25 WOL started working for my windows client.

RPC shutdown from Linux

sudo -i -u $linuxAdminUser -p $password net rpc shutdown -I $IPADDRESS -U $WindowsADM%$password -t 1 -f


RPC SHUTDOWN ERROR
To fix this issue


Manual Registry Hack
Open regedit.exe through the start menu search or run box, and then navigate down to the following key, creating a new key if it doesn’t exist.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
Change the LocalAccountTokenFilterPolicy to 1



On the right-hand side, add a new 32-bit DWORD value named LocalAccountTokenFilterPolicy and set the value to 1.
To remove this tweak you can set the value to 0 or just delete the key.
With this setup you will be able to startup and shutdown any pc you have listed in your startup and shutdown scripts.



References


Thursday, March 05, 2020

Setting up kiosk printing mode for Vend

In January of 2020 I wrote a post about Setting up a point of sale (POS) system for a Horizon library.  Since then we have decided enable our second location in VEND and setup a single register.  Vend has a great post on setting up Chrome for kiosk printing; which is great but there are two issues with it that are mutually exclusive; meaning that if you solve one problem it causes the other.  What I discovered is that Google Chrome, would either print the webpage header/footer on the receipt or you would have to hit print twice to print the receipt.  The new Microsoft Edge does not have this problem.

Setting up VEND it was highly recommended sticking to chrome on windows, though they have a long list of recommended hardware and software on their site.  

Typically when you print from a browser such as chrome, you print and you get the google print preview


Printing From Chrome
And you can also set it up to print from the system dialogue window by pressing Ctrl + Shift + P


System Printing Dialogue Window
This can be controlled from Google Admin if you have Google for Business/Non-Profit/Education by going into Device Management -> Chrome -> Settings

With the options of 

  • Allow using print preview
  • Always use the system print dialog instead of print preview

Google Admin - Control Print Preview
If your not using google admin you use the the command line switches in sequence a list of command-line-switches for the Chromium project can be found here

For chrome we want to put the following at the end of the quote after a space on the shortcut.


--enable-print-preview --kiosk --kiosk-printing


This enables chrome's print preview mode so it doesn't use the system's dialogue, puts the chrome browser in kiosk mode and kiosk-printing automatically causes chrome to hit the print button leaving the preview up for a second or two.  If your using google admin you can skip the --enable-print-preview flag if you have it defined in the settings as shown in the Google Admin picture above.  Below is chrome with the command line switches.



Chrome is great and it worked ok but the main issue we came across was with the print-preview enabled it would print the page header and footer on the receipt


Receipt with the website header and footer which is printed
when you have kiosk tags enabled on chrome.

If you disable the print-preview, and use the system dialogue box for printing the receipt turns out without the web page header/footer on the receipt, but you had to either hit return or press the print button twice which is not the best thing for a cash register.


Receipt with no web page header/footer

So I downloaded and installed the new chromium based Microsoft edge and tried the chrome command line witches on edge and they worked great!  In fact you don't even need the --enable-print-preview switch, the receipt comes out with no wasted paper and everything else works just as it did on chrome; so we switch our VEND register to Microsoft Edge.

Using the Vend article for setting up kiosk mode, I did also some additional things using group policy to secure the system, and setup a startup script when the computer launches.

Here are some additional actions I had taken to secure the VEND Register System
  • Create a admin and limited user (the vend register runs as the limited user)
  • Set the default page to be the vend register store, along with the home page setting
  • Create a startup script to launch edge using Task Scheduler
Task Scheduler

      "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
      --kiosk --kiosk-printing
  • Setup Group Policy to disable CTL+ALT+DEL options
Open the Local Group Policy Editor:
Click Start.
Enter Run.
Type gpedit.msc.
Click OK.
Navigate to User Configuration > Administrative Templates > System > Ctl+Alt+Del Options.
Prevent users from being able to use the following functionality by enabling the removal of the functions:
Remove Task Manager
Remove Lock Computer
Remove Change Password
Remove Logoff
To enable these to be removed:
Double-click the option.
Select Enabled.
Click OK.

Disable CTL+ALT+DEL 

  • Then to disable the windows key
Open regedit.
Click on the Windows menu and type run, then put in regedit
click HKEY_LOCAL_ MACHINE on Local Machine  
Double-click the System\CurrentControlSet\Control folder, and then click the Keyboard Layout folder. 
On the Edit menu, click Add Value, type in Scancode Map, 
click REG_BINARY as the Data Type, and then click OK. 
Type 00000000000000000300000000005BE000005CE000000000 in the Data field, and then click OK. 
Close Registry Editor and restart the computer.
Disable Windows Key

Tuesday, March 03, 2020

Papercut MF Print Client Issues on Microsoft Hyper-V

I've had recently finished a project involving Papercut MF and I have to say from my experience with the software for what the organization wanted it worked much better then it's competitors.  Both Staff and clients are relatively happy with the product and the process.  

As I am working though documenting the process for setup, user accounts, etc; I came across a odd issue with Papercut.  After setting up and configuring a Papercut server on linux, I setup a new Windows 10 vm on Hyper-V to show how the client can be run and installed the print client would not work... at all.  I can run the installer and it installs no problem, but when you go to run the program it launches then quits; and when you do the same thing on a non-vm system it works just fine.  You could argue it's not an issue with papercut, but it is a VM issue which I would agree with if doing the disk2vhd or other cloning/imaging methods did not work which is how I originally tested to see if the system and process were viable for the organization.


I've been able to replicate this issue 100% of the time with a new install of windows on a Hyper-V client with a Linux Papercut Server; the work around is to get an image, or do a p2v conversion of a system to get the papercut client to work on Hyper-V.  As you can see below.


Papercut client not working on fresh VM install.

Papercut is not running
Papercut is installed but not running as shown in the taskbar


After grabbing a disk2vhd image of another station with papercut installed, the client remained working running in a VM environment

The task bar shows the papercut print client is running

Papercut is installed and running

Taskmanager shows papercut is running

It is an odd issue one that I hope Papercut fixes in the very near future but for now I'll go with using a p2v image for doing my testing and documentation of papercut.

******UPDATE******

Because I am documenting the process for setting up a papercut server I also setup a windows version and noticed several differences between the Linux Client and the Windows client particularly with the number of DLL files included in the Windows vs Linux client directory as showcased below.


At any rate taking the windows client files provided by the windows version of the papercut server fixed my Hyper-V client issue without having to use a disk2vhd copy.  All that are required are the missing dll files, once you add those missing files to the linux server provided client for windows; the client does work properly on a clean Hyper-V VM.

Friday, February 28, 2020

Upgrading Server 2016 to 2019

Just before the end of February, my workstation's RAID 10 decided that it would be fun if I lost 2 drives on the same mirror.  So thankfully I had my OS on an SSD which was running but I did end up losing all my data but none of it was essential and it is pretty hard to backup 8tb.

So now that I'm more/less starting from scratch I thought it would be a great time to try an in-place upgrade of server 2016 to 2019!  HOW EXCITING!  I do have some software I will running on my C: including SQL server so it will be interesting to see what still works after the upgrade.  Now that I have some new drives and I can now setup a backup solution for some of my dev work!

Following the guide from microsoft.  https://docs.microsoft.com/en-us/windows-server/upgrade/upgrade-2016-to-2019

I saved the info they requested to a network drive and a flash drive.

open the cmd prompt and cd to c:\Windows\system32, and then type systeminfo.exe.

Results from running systeminfo.exe.

Host Name:                 "MY WORKSTATION"
OS Name:                   Microsoft Windows Server 2016 Standard
OS Version:                10.0.14393 N/A Build 14393
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Server
OS Build Type:             Multiprocessor Free
Registered Owner:          Windows User
Registered Organization:
Product ID:                xxxxx-xxxxx-xxxxx-xxxxx
Original Install Date:     2018-06-18, 6:36:57 AM
System Boot Time:          2020-02-26, 9:58:13 AM
System Manufacturer:       COMPUTER INC.
System Model:              WORKSTATION
System Type:               x64-based PC
Processor(s):              2 Processor(s) Installed.
                           [01]:  ~1200 Mhz
                           [02]:  ~1200 Mhz
BIOS Version:              American Megatrends Inc.
Windows Directory:         C:\Windows
System Directory:          C:\Windows\system32
Boot Device:               \Device\HarddiskVolume4
System Locale:             en-ca;English (Canada)
Input Locale:              en-us;English (United States)
Time Zone:                 (UTC-07:00) Mountain Time (US & Canada)
Total Physical Memory:     130,958 MB
Available Physical Memory: 115,100 MB
Virtual Memory: Max Size:  150,414 MB
Virtual Memory: Available: 132,449 MB
Virtual Memory: In Use:    17,965 MB
Page File Location(s):     C:\pagefile.sys
Domain:                    "MY DOMAIN"
Logon Server:              \\LoginServer
Hotfix(s):                 14 Hotfix(s) Installed.
                           [01]: KB3192137
                           [02]: KB4091664
                           [03]: KB4093137
                           [04]: KB4132216
                           [05]: KB4465659
                           [06]: KB4485447
                           [07]: KB4498947
                           [08]: KB4503537
                           [09]: KB4509091
                           [10]: KB4512574
                           [11]: KB4520724
                           [12]: KB4521858
                           [13]: KB4524244
                           [14]: KB4537764

NETWORK INFORMATION Gets listed with all details about your networks connected, such as VLAN Tags, IPs, etc

Hyper-V Requirements:      A hypervisor has been detected. Features required for Hyper-V will not be displayed.

Run and save the information from ipconfig /all

RESULTS FROM IPCONFIG

Windows IP Configuration

   Host Name . . . . . . . . . . . . : "My Workstation"
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : Domain1
                                       Domain2

All you networking information gets listed here starting with your default NETWORK and it lists all vlan tags, mac addresses, much as you would expect from the
"ipconfig /all" command.

Record 2 registry key entries.   BuildLabEx (version) and EditionID (edition)

I did a Registry Keys Export for a Backup and a screen shot for reference



I saved the upgrade info to a text file on the flash drive along with a screen shot of the registry and an export of the current version key.

I create upgrade media using rufus, then ran the installer as an administrator



NOTE:  You will need your server key when you upgrade

First it will check for updates, if there are none it will move on



then it will check and see if your ready to install, checking for enough disk space etc.  Here is where you will be asked for your product key


Then you will need to select your version of server in this case I'm picking (Desktop Experience)



Accept the notices and license terms





You will be asked what you want to keep, I'm going to just keep everything as is since I need to redo everything anyway.


Then it will do a check to see if there is any kind of issue in the way of the upgrade.



 Then it will ask you to install windows




I started this process at 2:30 pm and to get to 75% took about an hour and a half so it really does take it's sweet time.  So I would plan for a minimum outage of about 3 hours.  The system seemed to have taken the upgrade just fine however I was unable to connect to the server using RDP and I lost access to some unauthenticated network shares. Though I really should setup some security on this network share it is something I am not able to arbitrarily do at the moment as others require access to this share. 

So to fix this problem; you need to edit a registry entry "AllowInsecureGuestAuth"

located here (you can copy and paste the path into regedit):

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters

The update change the REG_DWORD to 0


AllowInsecureGuestAuth Value after upgrade

You need to change the value to 1 if you want to be able to access unauthenticated shares.


Change the REG_DWORD to 1 to allow access to unauthenticated shares

you can read the reference link below with the details.

https://support.microsoft.com/en-ca/help/4046019/guest-access-in-smb2-disabled-by-default-in-windows-10-and-windows-ser

Microsoft is defaulting on the side of security which I completely applaud them for; however I do have to re-enable unauthenticated access.  

It was also shortly after fixing my network share issue I noticed some issues with most of my virtual networks with most of my networks showing an error.




Most networks no longer work after upgrade.
After trying serveral times to fix the issue with updating drivers, rebooting, system scans, etc I gave up and decided that my in-place upgrade wasn't an in-place upgrade.  So I formatted my OS drive and did a clean install.

After doing a clean install of Server 2019, setting up the dual port nic into a teamed interface I still lost network connectivity after installing the Hyper-V roll.  This happened after I reinstalled another 2 times.  What I didn't realize even looking though forums this issue was hard to find a resolution to.  The only solution that worked for me was to follow this process I found on Microsoft Technet

https://social.technet.microsoft.com/Forums/en-US/5906152c-1f22-449a-b223-15c4a3e5eb36/2019-hyperv-virtual-switch-error?forum=winserverhyperv
  1. I had to remove Hyper-V role
  2. Restart
  3. Run  netcfg -d in a privileged powershell console
  4. I made sure I setup all my teamed networks after this
  5. Restart 
  6. Install Hyper-v role
This was what fixed my network issue in server 2019.  After running the netcfg -d command, and re-installing the hyper-v roll my virtual switches came back without an issue.  This network issue after installing the Hyper-V roll also occurred when I had set up the server on a regular network interface (NOT TEAMED).  This would not be good if I had to keep the virtual machines running but at least I would be able to export them and re-import them.  This is compelling me to try and do a mockup in place upgrade; even though this one went sideways I think I can come up with a process to do it.

Tuesday, February 25, 2020

SNMP and Network Printing in Windows

SNMP can be pretty useful, it is used for collecting and organizing information about managed devices on IP networks.  It allows you to get information about a device such as a printer.  Why do I bring this up because if you not careful, it can cause your windows printers to appear offline depending on how your printer driver is configured.

Now when we setup printers we don't deviate to far from the defaults if at all.  However because we have a number of printers that are under contract and to automate the submission of the use count we were asked to install a piece of software called FMAUDIT.  Now the setup of the software was really easy but you don't get to control any of the settings until after you've installed the software.  By then it has scanned your network, I would prefer to have it ask me to scan the network while it is install or if I would prefer to add the network later (forewarning to anyone installing the software).  The software uses SNMP to scan the network and add all printers using the SNMP community name "scanme1".  It added all my printers with "scanme1" to it's database, So I decided to change the SNMP of our contract printers to something else lets call it "scanme2".  When I did that the software got the printers and did what it needs to do.  However the Windows printservers suddenly put the printers offline because the driver is using SNMP to talk to the printer.

To view this go to Printer Properties -> Ports -> Configure Ports


Printer Properties Dialog Box

and in the configure ports dialog box you have the option of enabling or disabling SNMP Status and if you have it on but the community name is not correct the printer shows as offline (Which makes total sense).


SNMP Location in the Configure Driver

As you can see below the image is showing that the printer JLL-Toshiba-Copier is offline.


SNMP Community name mismatch causes a printer to show up offline

So you have two options for fixing this issue.
  1. Make sure that the SNMP community name in the driver is set to the same as the printer 
  2. disable the SNMP status for the windows driver.  
It is pretty useful to have so I just changed the name from SCANME1 to SCANME2, and the printer came back with no problem.  Remember by default windows enables SNMP lookup so do keep that in mind.


Making sure the community name is the same or disabling SNMP in the driver will bring the printer back online.

Thursday, February 06, 2020

Renaming an Windows Essentials Server

I have a few servers setup with server essentials because I have some software I wanted to run on Windows server but couldn't use full server and Windows 7 and 10 were not desirable.  I recently needed to change the name on one of these servers but it was a little tricky.  As shown below the server is currently named SIP

The server to be renamed
Unfortunately, when we get the item's properties, the name and domain change is not available. 

Name and Domain change is not available.
 Edit the registry and go to the entry HKLM\System\CurrentControlSet\Services\CertSvc

Edit the registry
 You can export the key if to back it up, I have found it is not necessary.

Export the CertSvc
 Delete the CertSvc registry

Delete the CertSvc registry entry.
Once you remove the key and reboot you will then be able to change the name of the system.

Now able to rename the server

When you change the computer name you will see this warning.  If you are using AD users be careful, It did not affect the server I was using but just be mindful.

Essentials warring on renaming

After you change the name and reboot your computer name will be changed.

Name Change
After changing the name and rebooting the system we can see that our system name is changed and we can still login to the system despite the warning.

System renaming is complete

You can see my full 8 minute video on how to do this on my YouTube page https://youtu.be/DP76WpqlUFo


References
https://winadminnotes.wordpress.com/2015/11/19/renaming-the-windows-server-essentials/

Updating your godaddy certs during the G2 intermediate hierarchy to the TLS Root CA - R1 hierarchy

  If you use godaddy TLS certificates you should be aware of some changes during the transition from the G2 certificates to the new R1 Certi...