Wednesday, September 22, 2010

My Computer autolabel script

As a systems administrator I log into A LOT of different servers and VDI desktops. Sometimes I would get confused as to which computer I was on. So now I included this as part of the logon script:

=============8<===============
Const MY_COMPUTER = &H11&

Set objNetwork = CreateObject("Wscript.Network")
objComputerName = "My Computer"&vbCr&"["&objNetwork.ComputerName&"]"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_COMPUTER)
Set objFolderItem = objFolder.Self
objFolderItem.Name = objComputerName
=============8<===============

Works like a charm! Now my computer icon says:

My Computer
[hostname]

Just a quick look to the desktop and I know which system I am on.

No comments:

Post a Comment