Patch Tuesday just happened a couple days ago and once again I had a single computer in the office that logged into a blank black screen. This is now the third computer over the last year to do this immediately after rebooting due to Windows updates. Trying to manually start Explorer.exe didn’t work. Scan disk came back clean. Safe mode gave the same results. Booting off a Windows 10 USB and doing a startup repair didn’t help. But thankfully the following fix has worked each time to get us back working.
Start with a CTRL+ALT+DEL to open Task Manager then File -> Run new task. Enter CMD and check off the box for “Create this task with administrative privileges”. Then run each of these commands in order:
Our domain has gone through multiple upgrades over the years from Server 2003 to the current Server 2019 domain controllers with a mix of 2012 and 2019 member servers. Each time there is a group policy admin template update I download it and copy it over to the central store. Today I went to edit a GPO object and noticed when checking the settings being applied under the “settings” tab there was a “Extra Registry Settings” section for a old version of Office under the administrative templates section:
After some research a couple things said to download the old templates, install them, remove the settings, then remove the templates. But that got me thinking on how old some of the templates probably are at this point and how I probably also had a bunch of no longer needed settings in GPO.
I then made a backup of my current templates by browsing to \\domain.name\SYSVOL\domain.name\Policies and creating a directory called “Old PolicyDefinitions”. I went into the PolicyDefinitions folder, selected everything, cut it, and moved it to my old folder. I then copied all the new templates from my computer, Windows 10, Office, and OneDrive, to the now empty PolicyDefinitions folder.
Now that everything was shiny and new I went through every GPO and checked for that Extra Registry Settings section and there were a bunch. References to Office 14.0 and 15.0 that are no longer used, SkyDrive, misc Windows XP settings, depreciated settings that are just not in the latest templates, etc. Now there are two choices here. Either I had to screen shot each one of these screens, switch back to the old templates, remove things, and switch back or thankfully there is a PowerShell command you can use on the domain controller:
Name is your GPO name. Key is going to be whatever is in the extra settings list. HKLM for anything computer config related, HKCU for anything user config related. You can also delete entire keys by omitting the -ValueName part but you will have to delete subkeys first. I.e. Office\14.0\Word\Common needs to be deleted before Office\14.0\Word can be deleted. I deleted a bunch, hit F5 in Group Policy Management so the settings screen would refresh, then delete what was left.
After a hour or so I had all my GPOs cleaned up with all the obsolete junk removed and also went through a bunch of settings that don’t need applied any more. Between the two I probably removed 100 entries which should speed up group policy processing if even slightly.
Recently ran into a situation where we were taking over a office that had a single Ethernet run to each desk that we needed to provide new IP phone along with PC connectivity. Now I don’t really like doing this, multiple points of failure, more complicated config, etc but running new cabling was going to be cost prohibitive so I have to work with what I got.
The core switch was going to be a older Dell N3024p, the phones Mitel 5340. We use DHCP exclusively for the Mitels using Option 43 which there is already a good guide on setting up. The tricky part was getting the phone on one VLAN but the PC port on a different VLAN and not having to manually set anything up on the phones. So this is what we ended up doing.
For this network VLAN 10 was for users/computers (10.40.10.*) and VLAN 20 was for phones (10.40.20.*). The switch ports on the Dell were setup as “General” ports using the following config:
switchport mode general
switchport general pvid 10
switchport general allowed vlan add 10
switchport general allowed vlan add 20 tagged
switchport general allowed vlan remove 1
switchport voice vlan 20
So any packet arriving at the switch that was not tagged would be tagged VLAN 10. It also accepted tagged packets as long as they were from VLAN 20. After removing the default VLAN 1 nothing else would be accepted on the port. I also set VLAN 20 as voice traffic as the Dell switches have some QoS for voice that is enabled.
Now the tricky part. I want the phone to request DHCP but by default it’s going to start off on VLAN 10 since it’s traffic won’t be tagged at first. In comes Option 43. I add the manufacture specific DHCP option to the DHCP scope for the users subnet, 10.40.10.*, since that’s what the phone will first request on and I only put in enough for the phone to switch over to the phones vlan:
The phone gets this, sets itself to VLAN 20, and retries DHCP. Now the request is coming from the 10.40.20.* subnet which in DHCP has the full Option 43 string:
A little while back I posted a macro to batch covert Visio VSD files to VSDX files which got a decent number of people messaging me. Recently I found how many excel files we had using the old format which just like old Visio files take up a lot of extra space. So I went through and modified my Visio converter over for Excel. So here is a step by step to write your own Excel file converter:
Open a new Excel document. Save it as a “Excel Macro-Enabled Workbook (*.xlsm)
In the first cell put something like “To run the conversion hit ALT+F11 to open the program then F5 to run it”.
Hit ALT+F11 to open up the Microsoft Visual Basic for Applications screen
Right click “ThisWorkbook” at the top left then Insert -> Module
In the module copy and paste the following in:
Public FilesAttempted As Integer
Public FilesConverted As Integer
Public FilesDeleted As Integer
Public FilesSkipped As String
FilesAttempted = 0
FilesConverted = 0
FilesDeleted = 0
FilesSkipped = ""
Dim FileSystem As Object
Set FileSystem = CreateObject("Scripting.FileSystemObject")
Dim HostFolder As String
Dim DeleteOriginal As Boolean
Dim RemovePersonal As Boolean
''' HostFolder is directory to start at. Change to your base directory.
HostFolder = "C:\temp"
''' DeleteOriginal will delete the original file as long as the xlsx was created. Either True or False
DeleteOriginal = False
DoFolder FileSystem.GetFolder(HostFolder), DeleteOriginal
MsgBox "Conversion complete! " & vbCrLf & vbCrLf & "Files attempted: " & FilesAttempted & vbCrLf & "Files converted: " & FilesConverted & vbCrLf & "Files deleted: " & _
FilesDeleted & vbCrLf & "Files with issues: " & vbCrLf & FilesSkipped, vbOKOnly + vbInformation, "Conversion Complete"
Sub DoFolder(Folder, DeleteOriginal)
On Error GoTo ErrHandler:
For Each SubFolder In Folder.SubFolders
DoFolder SubFolder, DeleteOriginal
Dim myWorkbook As Workbook
For Each File In Folder.Files
' For each file name sure its a xls and not a temp file
If ((Right(File, 3) = "xls") And (Right(File, 4) <> "~xls")) Then
FilesAttempted = FilesAttempted + 1
' Open the file
Set myWorkbook = Workbooks.Open(File)
' Save as a xlsx and increase our counter
myWorkbook.SaveAs Filename:=File & "x", FileFormat:=xlOpenXMLWorkbook
FilesConverted = FilesConverted + 1
' Delete the original if set and the new xlsx exists
If ((DeleteOriginal = "True") And (FileExists(File & "x"))) Then
SetAttr File, vbNormal
FilesDeleted = FilesDeleted + 1
Debug.Print "Error encountered. Error number: " & Err.Number & " - Error description: " & Err.Description
If File <> "" Then
FilesSkipped = FilesSkipped & File & vbCrLf
Function FileExists(ByVal FileToTest As String) As Boolean
FileExists = (Dir(FileToTest) <> "")
Change the HostFolder to the directory you want to run this on and hit F5 to run. It will open each Excel workbook with a xls extension in that directory, and all sub directories, then save it as a xlsx. If you want it to automatically delete the old xls file change the DeleteOriginal variable to True or just manually delete them after conversion.
So our SAN SSL certificate was coming up for renewal and I really wanted to expand what was covered by it to include more devices. In general anything internal was using a self signed certificate and anything external used the SAN SSL. That worked fine but when it came time for renewal I figured why not just get a wildcard SSL and assign it to anything I could. Also would keep me from having to update subject names when there was a change.
So I bought a Wildcard SSL from GoDaddy and started assigning it to everything. Switched out the certificate on our firewall and VPN clients, mail server, web server, etc. Everything seemed to work fine. Then it came time to remove the old one once things were tested. Removing from IIS was fine, removing from the firewalls likewise fine, but removing from Exchange Control Panel gave the error in the title.
Now we do have a Exchange Online Hybrid deployment setup with centralized mail transport. We use a cloud based Barracuda spam/malware filter so all email in and out of the company goes through them then to our internal mail server. Any mailbox on Exchange Online then goes from our mail server to it and back. Well apparently when I set this up it made a send connector to route mail to Exchange Online and since it uses TLS attached the certificate that was currently being used which I was now trying to delete.
Unfortunately you can’t just go into the Send Connector in the ECP and reassign the certificate but you can do it by following some steps based on the Microsoft Set-SendConnector page. First get the list of your send connectors and the list of your certificates:
Copy the send connector that was in the error message and also the thumbprint for your new certificate. Next we will use that certificate to pull out the information needed to assign to the send connector and assign it:
Once your send connectors are updated you should be able to remove the old certificate. Also if you are using TLS on your receive connectors you will want to do the exact same thing but using the Set-ReceiveConnector command.
First things first. You will need a Pi Zero W (if you have a local MicroCenter they have them in store for $5 pretty often), a 8Gb micro SD card, a micro usb cable to power the zero, and a way to write to the SD card, either a SD card adapter or your computer if it has a slot for it. You may also want a case to put yours in if you plan on mounting it and don’t want to short anything out (my personal favorite that runs about $6). If you want to actually see whats going on you will also need a mini HDMI to HDMI cable although hopefully you don’t need to do that. And if you want to get really fancy you can get a Pi Zero W with header pins (or solder some on yourself) and a display such as the Adafruit one to show the IP address and some status info.
Format the SD card using the SD Card Formatter utility.
Using balenaEtcher burn the Raspbian image to the SD card. By default it will “eject” the SD card once its done. You also might get Windows warnings about a problem with the disk, ignore these and close/cancel the warnings.
Pop out the SD card and put it back in. You might get the same warnings, again ignore them.
Using Notepad (or Notepad++) create a file named “ssh” with no extension and a single space in it. Save that to the root of the SD card along with the other files.
Again using a notepad program create a file called “wpa_supplicant.conf” with the following text (using your country code, SSID, and password) and save that to the root of the SD card. If your SSID is being broadcast you do not need the scan_ssid line as it will slow down the connecting slightly although it doesn’t hurt to have it in there (see here for more info on this file):
You should have everything on the SD card needed to boot up and connect to your WiFi. Properly eject the SD card from your computer, pop it into the Pi, and boot it up.
Give it 90 – 120 seconds to boot. Since this guide is for getting Pi-Hole setup you will want to have a static IP address for your Pi. Go into your router and find out what the current IP address is and also set a reservation or lock the current IP address to your device.
Until it reboots it will be at whatever IP it was assigned. Start up PuTTY and put in the current IP address and connect. You will get a security warning, click Yes to accept the keys.
Your Pi is now on your network so the hard part is done. Next is to configure some basic settings and install Pi-hole
Login using the default user “pi” and password “raspberry”
Now by default the Pi is setup for the EN_GB locale which means your @ symbol and some others aren’t where they normally are which caused me some issues. So lets tell the Pi to add the EN_US locale and change our keyboard layout.
Type in sudo raspi-config and enter
Select option 4 for Localization then the first option for Locale
In the list scroll down and select en_US.UTF-8 UTF-8 by hitting the space bar to select it then enter
It will ask you to select a default language for the system. Select en_US.UTF-8 and enter. Give it a minute while it makes the change.
At this point for me I tried to change the keyboard layout but it didn’t work. It seems the Pi needs to be rebooted for these changes to take effect so first get out of the config menu by hitting the right arrow twice and selecting Finish
Back at the prompt type in sudo reboot. You will be disconnected, give the Pi a minute or so to reboot. Remember if you set a DHCP reservation the IP address may change when it comes back up.
Connect with PuTTY and login again. Easiest way is to click the PuTTY icon in the top left corner of the program and select “Restart Session” then log back in or just close and reopen the software.
Go back into the config with sudo raspi-config and enter
Select option 4 then 2 for change timezone. Select your country and city for your timezone (US -> Eastern for example).
Select option 4 again then 3 for the keyboard. In the list you should have a Generic 104-key PC option. Select that then English (US) or whatever keyboard layout you’d prefer. If you don’t see English (US) click Other first then it should be in the list. Hit enter to select then select the actual keyboard layout. You will be asked a couple more questions, select the appropriate answer (usually the defaults).
You can also go into the same menu to select US as your wireless country.
Now would also be a good time to change your password to something other then the default raspberry. Select the first option and enter a new password.
Select Finish to exit the config menu.
So the next recommended thing to do is update the Pi to the latest software:
At the terminal prompt type sudo apt-get update -y and enter. It might take a minute or two.
Next type sudo apt-get upgrade -y and enter. Chances are this will take 10 – 20 minutes as updates are downloaded and installed.
Once the updates are done reboot again with sudo reboot, log back in using PuTTY, and install Pi-hole:
At the terminal prompt type in curl -sSL https://install.pi-hole.net | bash and enter
Go through the prompts and answer as you want it setup. Note the admin webpage password at the end as you will use that to login at http://YourPiAddress/admin. Lastly set your router DHCP to hand out the Pi-hole IP address for DNS instead of itself and you should be all set.
Windows Update & WSUS have been a thorn in my side for many many years. When it works its great but when it doesn’t it can be very frustrating to figure out what went wrong. Over the years I’ve had to rebuilt WSUS twice, once when it just stopped pushing updates and another time where it imploded itself and corrupted the database. Recently we had a number of computers, around 10%, stop reporting back to WSUS for status. They also reported no updates available when checking for updates using WSUS. We tried all the troubleshooters, DISM cleanups, etc, but nothing seemed to work. I thought maybe it was WSUS again but that wouldn’t make sense with so many successfully getting updated. Even tried the Microsoft recommendations on resetting Windows Update but in our case BITS didn’t want to stop. And related to this we were getting Task Host errors on shutdown for those machines with the reason being “AutomaticUpdateHost” which would make sense if BITS was stuck.
After some testing we found that the Microsoft recommendations did work when in safe mode. Problem was doing this as easily with the least amount of downtime and hands on touching. To that end I created a series of three batch files. The first one, run as a administrator, will set the boot options to safeboot with networking and reboot:
I put all three into a folder and placed it on the desktops of the troubled computers then ran each in sequence. First the computer rebooted in safe mode, then Windows Update gets reset along with deleting all temp files, then the computer reboots normally.
So far every computer this was run on has reported in. Not sure what causes this in the first place but at least we have a quick solution now.
Note: The script was written to be run in regular mode so its stopping services that are normally already stopped in safe mode but was just reused for this purpose on the machines where BITS kept getting stuck.
After some trail and error from my previous post we went through batch converting 300+ Visio vsd files over to vsdx. Overall the files size was reduced by 70%, dropping from over 6 Gb to around 2Gb, and allowing the files to open/save to the network a lot quicker. The only caveat I found was Visio 64-bit is the best way to do this and is most stable, especially with files over 25Mb. Above about 33 – 35Mb and the 32-bit version would randomly crash. With that said I added in some basic error detection to skip corrupt Visio files, some user variables to keep personal info or remove along with deleting the original file or not, and the ability to do sub directories. Here is the modified code:
Public FilesAttempted As Integer Public FilesConverted As Integer Public FilesDeleted As Integer Public FilesSkipped As String
Sub ConvertToVsdx() FilesAttempted = 0 FilesConverted = 0 FilesDeleted = 0 FilesSkipped = "" Dim FileSystem As Object Set FileSystem = CreateObject("Scripting.FileSystemObject") Dim HostFolder As String Dim DeleteOriginal As Boolean Dim RemovePersonal As Boolean
''' HostFolder is directory to start it. Change to your base directory. HostFolder = "T:\" ''' DeleteOriginal will delete the original file as long as the VSDX was created. Either True or False DeleteOriginal = True ''' RemovePersonal will remove personal information from the file. Reduces the size a little but you might want to keep the original info RemovePersonal = False
Sub DoFolder(Folder, DeleteOriginal) On Error GoTo ErrHandler: Dim SubFolder For Each SubFolder In Folder.SubFolders DoFolder SubFolder, DeleteOriginal Next Dim File For Each File In Folder.Files ' For each file name sure its a vsd and not a temp file If ((Right(File, 3) = "vsd") And (Right(File, 4) <> "~vsd")) Then FilesAttempted = FilesAttempted + 1 ' Open the file Application.Documents.Open File ' Remote personal info if set If RemovePersonal = True Then Application.ActiveDocument.RemovePersonalInformation = True End If ' Loop through each master then check across pages to see if it is used Index = Application.ActiveDocument.Masters.Count While Index > 0 bMasterUsed = False Set oMaster = Application.ActiveDocument.Masters.Item(Index) For Each oPage In Application.ActiveDocument.Pages For Each oShape In oPage.Shapes If oMaster.Name = oShape.Name Then bMasterUsed = True End If Next Next ' if Not used delete it from the document stencil If bMasterUsed = False Then oMaster.Delete End If Index = Index - 1 Wend
' Save as a vsdx and increase our counter Application.ActiveDocument.SaveAs File & "x" Application.ActiveDocument.Close FilesConverted = FilesConverted + 1
' Delete the original if set and the new vsdx exists If ((DeleteOriginal = "True") And (FileExists(File & "x"))) Then SetAttr File, vbNormal Kill File FilesDeleted = FilesDeleted + 1 End If NextFile: End If Next Done: Exit Sub
ErrHandler: Debug.Print "Error encountered. Error number: " & Err.Number & " - Error description: " & Err.Description If File <> "" Then FilesSkipped = FilesSkipped & File & vbCrLf GoTo NextFile: End If End Sub
Function FileExists(ByVal FileToTest As String) As Boolean FileExists = (Dir(FileToTest) <> "") End Function
If you use this please let me know how it goes or any tweaks that need to be made.
Recently we pushed some updates through GPO which ran at a users login to the domain. Weeks went by and I kept getting calls about people with old software that didn’t update. After some quick investigating these users were simply not rebooting or shutting down their computers and some were going on two months. On one hand that’s pretty good for Windows 10 machines but on the other they were missing important updates. After looking around I found that PsInfo.exe, part of the PSTools suite, would let me poll a computer for uptime but I wanted to poll all the computers and see how widespread this problem was.
First I started with a list of all computers taken from Active Directory using this PowerShell command to export them to a text file. Technically this command exports to a csv but I’m only taking one column so I skipped a step:
Get-ADComputer -Filter * -Properties Name | Select-Object Name | Export-CSV "C:\temp\ComputerNames.txt" -NoTypeInformation
Opening the file you should have a header of Name with all your workstations. I deleted the header and did a global find and replace to remove the quotes so I had a file with just the workstation names. Next I made a batch file with this single line:
For /f "tokens=*" %%i in (ComputerNames.txt) do psinfo uptime -nobanner \\%%i >> uptime.txt
I placed the batch file (CheckUptime.bat for me) in the same directory as PsInfo.exe and my ComputerNames.txt file. Run the batch file and it will step through each computer name in the file and check the uptime giving you something like this:
System information for \WSComputer2: Uptime: 0 days 5 hours 24 minutes 57 seconds System information for \WSComputer6: Uptime: 2 days 17 hours 45 minutes 18 seconds System information for \WSComputer23: Uptime: 0 days 0 hours 42 minutes 41 seconds
I’m sure there is also a way to scrap the file and clean this up but it works for my needs.
So as a follow up to my post Adding a SSL Certificate to a Vykon AX Web Supervisor the way WorkPlace N4 web supervisors imports a certificate is slightly different. Mainly the key needs to be in a unencrypted RSA format which was tripping me up. So if you need to do this first read that prior post and then the only real change is for exporting out your key use this command:
You will find the key will be exported and have a “RSA” tag in the headers now. Follow the same instructions from the other post to make your pem file (key, cert, intermediate, root) and it should import into a N4 supervisor just fine.