I've worked in IT for many years at this point. I thought I would share some of the things I had learned. When I went to review my notes, they were not as expansive as I thought. Most of the documentation I have created over the years is site specific, so there is not as much on this blog as I thought. I was hoping to have a bit more to share. My hope is that the information I do have here helps someone.
Friday, March 13, 2026
Wednesday, March 4, 2026
To remove stuck and pending Windows updates
These commands can remove pending and stuck Windows updates. This can be helpful if you have Windows updates that won't be applied. The part in red you need to replace the package name with what you want to remove. The first command line shows all Windows updates. You'll need to open CMD as an admin to run these. Once you open the packages text, (the output path can be where-ever you like), the column, State will tell you if it's pending. Once you remove it, running the Windows update should show this again, ready to be installed.
To remove Windows updates, use these commands:
dism /online /get-packages /format:table > C:\packages.txt
dism /online /remove-package /packagename:replace_this_
Tuesday, March 3, 2026
Create copy of mRemote connections
I used this script to create a copy of mRemote connections. If you use mRemote to managed remote connections backing up this file can come in handy if you need it for some reason, such as moving to a new computer or mRemote becomes corrupt. I created this as a task in Windows task scheduler so that it ran periodically on it's own. Change user to the username you would like to copy this from.
REM This script line is to copy the mRemote connection file and provide a backup to my P drive
xcopy /s /y C:\Users\user\AppData\Roaming\mRemoteNG\confCons.xml P:\mRemoteBackup
Thursday, February 19, 2026
Clear out GPOs
These commands I found useful when you needed to clear out old GPOs and have them reloaded. This removes all the GPOs using registry edits and when the machine does an AD refresh, it'll get the new ones applied. These commands can be run from a CMD.
reg delete "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft" /f
reg delete "HKEY_CURRENT_USER\Software\Policies\Microsoft" /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Group Policy" /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies" /f
gpupdate /force
gpresult /h c:\temp\results.html
MSERT AV tool from Microsoft
MSERT is an AV tool from Microsoft that independently scans a computer for viruses. It's free to use, but it's only good for about 10 days and it only works on demand. You cannot schedule it, unless you push out the below commands on a schedule.
Download the latest copy from https://docs.microsoft.com/en-us/windows/security/threat-protection/intelligence/safety-scanner-download
You can run it from the GUI after download or
You can run the scanner with the command line MSERT.exe /f:y /q
· Command line switches
o The following command to do a full scan and automatically clean infected files: msert /f:y
o The following command to run a scan quietly: msert /q
o The following command to execute a full scan quietly: msert /f /q
After scan reports are saved in C:\Windows\Debug
Expand a VG (volume group) in Linux
If it's a VM, log onto the virtualization server and add a disk to the server
Log into the server as root. The items in red are what you will need for your environment.
1) Run this command:
lsblk -fo name,fstype,mountpoint,size
2) Run this command to initialize the new storage as a PV:
pvcreate /dev/sdX
3) Run this command to identify the VG you want to extend:
vgs
4) Run this command to add the new PV to the VG:
vgextend <vg_name> /dev/sdX
5) Run this command to check the updated VG size:
vgdisplay <vg_name>
6) Run this command to identify the LV you want to extend:
lvs
7) Run this command to extend the LV using available space in the VG:
lvextend -L +100G /dev/<vg_name>/<lv_name>
(run this command with less free space than you added to prevent Linux from throwing a fit)
8) Run this command to rescan the drives:
for host in /sys/class/scsi_host/host*; do echo "- - -" | sudo tee $host/scan; done
I personally haven't had the below command work well for me. I usually do step 7 but you could try this instead. Once I figured out the commands needed, it takes me less that 10 minutes.
Run this command to extend to all free space in VG
Lvextend --size +100%FREE logical_volume
Enable or Disable root from SSH
The following steps worked for me in Ubuntu 24.04 LTS.
*Open up command line
*User vi or nano to open this file /etc/ssh/sshd_config
In this file, search for the line “PermitRootLogin” and update the line to look like in the below file excerpt. On some Linux distributions, the “PermitRootLogin” line is preceded by the hashtag sign (#) meaning that the line is commented. In this case uncomment the line by removing the hashtag sign and set the line to no or yes as needed.
*PermitRootLogin no / yes
If using VI type ESC and :wq to save changes
After changes made in the terminal type systemctl restart sshd
From <https://www.tecmint.com/disable-ssh-root-login-in-linux/>
Commands to check for updates - Windows
Power shell command to check for new updates
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
Commands to install the udpates
*Use the following lines on Windows 10 clients
USOClient.exe StartInstallWait
USOClient.exe StartInstall
*Use the following line if the client is earlier than Windows 10
wuauclt /detectnow /updatenow
Do a reboot after the updates are done
Wednesday, February 18, 2026
Script to Add local user to Administrators
This is a script to add a user, create their password and add them to the local administrators group on a Windows computer. Everything with an * is a command line. I pushed this out with PDQ Deploy. This can be handy if you want to create a local admin user but not use the built in Windows administrator.
Items in red need changed to specific instance you want. These commands can be run in CMD.
To create the user
*net user /add username
To change a local user’s password
*net user username password
To create a new local account
*net user username password /add
To add the new user to the local admin group
*net localgroup administrators username /add
To disable the built-in admin account
*net user administrator /active:no
To set account password to never expire
*WMIC USERACCOUNT WHERE Name="username" SET PasswordExpires=FALSE
Introduction
Introduction
I've worked in IT for many years at this point. I thought I would share some of the things I had learned. When I went to review my note...
-
These commands can remove pending and stuck Windows updates. This can be helpful if you have Windows updates that won't be applied. The...
-
These commands I found useful when you needed to clear out old GPOs and have them reloaded. This removes all the GPOs using registry edits a...
-
MSERT is an AV tool from Microsoft that independently scans a computer for viruses. It's free to use, but it's only good for about 1...
