Windows: Server stuck in shutdown after installing patches

One of my servers in my labenvironment refused to gently reboot after installing a ton of patches that I.. uhm.. forgot to install.
The “restart-computer -computername DC1” cmdlet wouldn’t do anything, as it returns with : Restart-Computer : Failed to restart the computer dc1 with the following message: A system shutdown is in progress.

Figures, the server is physical, and about an hour drive away.

The (somewhat crude) solution:
Use PSkill.exe to kill the TRUSTEDINSTALLER process. (Note: this is not recommended, but what the hell, this is a testenvironment).

1. Download the utility here
2. Extract it somewhere, open a elevated CMDlet window, and CD yourself into the exctracted folder.
3. Use this command to kill the respective hangig process: pskill.exe \your-server your-process (In my case: pskill.exe DC1 TRUSTEDINSTALLER).

The server then booted after about a minute, and about 15 minutes later it was available through RDP.

-F

Windows: Autologon for Domain User

I have some machines in my lab at home that, due to heavy testing and other stuff, reboots often.
Some of my applications are dependent on the user beeing logged on to function properly – so instead of manually logging on each time my server boots, I fiddled around in registry to make the domain user log on automatically.

This, of course, is not recomended in any production environment, but for lab purposes, I find this trick very useful.

1. First, open regedit on the machine you want to fiddle with.
2. Navigate to HKLMSoftwareMicrosoftWindows NTCurrentVersionwinlogon
3. Make a backup of winlogon.
4. Change the following values (you may need to add some of them if they’re not present).

AutoAdminLogon = 1 (String Value Key) (0 means off, 1 means automatic)
DefaultUserName = Username (String Value Key)
DefaultPassword = Password (String Value Key)
DefaultDomainName = yourdomain.com (String Value Key) (Only needed if this computer has joined a domain)

4. Reboot

The user should now log on automatically.
As you see, the password is displayed in clear text, so beware.

– F

List Windows Server OS

I always forget the correct line for listing these things with WMI.
Therefore, it’s now perpetuated on Fuffle.net. =)

cls
$servers = get-content "C:tempserverlist.txt"
foreach ($s in $servers){
$gwmi = (Get-WmiObject -ComputerName $s -class win32_operatingsystem -ErrorAction SilentlyContinue).caption
    write-host "$s - IP:"([System.Net.Dns]::GetHostAddresses($s)) - $gwmi  -foregroundcolor “green"}

-F