I try to avoid logging onto server consoles these days, preferring to do things remotely, via cli, ssh remote PowerShell etc. Somethimes though, you just have to.
When I do , I really don’t like waiting for the Server Manager app to load. Rather than wait and close it off each time, I investigated a way to disable the functionality altogether.
The boring way is to go to the Server Manager Properties and check the “Do not start Server Manager automatically at logon” checkbox;
…..the cool way is to do it remotely, using PowerShell using the “New-ItemProperty” command to add a new Registry key to the HKCU\Software\Microrosft\ServerManager hive called (funnily enough)
” DoNotOpenServerManagerAtLogon”
To do to a single host, run the following one-liner (from the actual host)
1 |
New-ItemProperty -Path HKCU:\Software\Microsoft\ServerManager -Name DoNotOpenServerManagerAtLogon -PropertyType DWORD -Value "0x1" –Force |
As mentioned, this is a new key, so you can check for it’s existence or successful creation by using the “Get-Item” command;
1 |
Get-Item HKCU:\Software\Microsoft\ServerManager |
Before running the New-ItemProperty command;
After running the New-ItemProperty command;
Run it remotely using the Invoke-Command cmd; (assuming RMAN is enabled and configured);
1 |
Invoke-Command -ComputerName RemoteHost -ScriptBlock { New-ItemProperty -Path HKCU:\Software\Microsoft\ServerManager -Name DoNotOpenServerManagerAtLogon -PropertyType DWORD -Value "0x1" –Force} |
You could apply it to larger numbers of hosts by input filtering via OU, Name, Domain, or by feeding in a list using a For-Each loop.
For example, here I’m going to apply it to all Servers in an OU called “LocalServers” in a domain called “yourDomain.com.au”
1 2 3 4 |
$targetServers=Get-Adcomputer -filter * -searchbase "ou=LocalServers,dc=YourDomain,dc=com,dc=au"| ForEach-Object {$_.Name} ForEach($server in $targetServers) { Invoke-Command -Computername $server -ScriptBlock {New-ItemProperty -Path HKCU:\Software\Microsoft\ServerManager -Name DoNotOpenServerManagerAtLogon -PropertyType DWORD -Value "0x1" –Force} } |
Whichever way you do it, think of the time, CPU cycles and Memory you save and treat yourself to a coffee.
Not sure how the powershell option is better. The boring way works and is far simpler!
Hi Martin, Until you need to do it to dozens/hundreds of hosts, then scripting is king 🙂