This small script I created around Feb 2011 to stop administrators with logonscripts assigned to the Active Directory profile from running(which I’m sure you know can cause havoc)
Just place it as high up the standard logon script as possible so this runs before anything else(Obviously you can modify to run on specific servers etc if need be)
' Stop-server-logon-script
' Sean Wright v1.0 08/02/11
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
osnamed = objOperatingSystem.Caption
res = InStr(UCase(osnamed), "SERVER")
if res > 0 then
wscript.echo "YOUR ON A SERVER LOGON SCRIPT WILL NOT RUN!!"
wscript.quit
end if
Next
No comments:
Post a Comment