Network Administration

System Administration

1) GettingLocalComputerInformation


Set
objComputer=CreateObject("Shell.LocalMachine")

Wscript.Echo
"Computername:"&objComputer.MachineName
Wscript.Echo
"Shutdownallowed:"&objComputer.IsShutdownAllowed
Wscript.Echo
"FriendlyUIenabled:"&objComputer.IsFriendlyUIEnabled
Wscript.Echo
"Guestaccessmode:"&objComputer.IsGuestAccessMode
Wscript.Echo
"Guestaccountenabled:"&_
    objComputer.IsGuestEnabled(0)
Wscript.Echo
"Multipleusersenabled:"&_
    objComputer.IsMultipleUsersEnabled
Wscript.Echo
"Offlinefilesenabled:"&_
    objComputer.IsOfflineFilesEnabled
Wscript.Echo
"Remoteconnectionsenabled:"&_
    objComputer.IsRemoteConnectionsEnabled
Wscript.Echo
"Undockenabled:"&objComputer.IsUndockEnabled


2) RestartaComputer

strComputer
="atl-dc-01"
Set
objWMIService=GetObject("winmgmts:"_
    &"{impersonationLevel=impersonate,(Shutdown)}!\\"&_
        strComputer&"\root\cimv2")

Set
colOperatingSystems=objWMIService.ExecQuery_
    ("Select*fromWin32_OperatingSystem")

For
EachobjOperatingSystemincolOperatingSystems
    objOperatingSystem.Reboot()
Next

3) ShutDownaComputer

strComputer
="."
Set
objWMIService=GetObject_
    ("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\"&_
        strComputer&"\root\cimv2")

Set
colOperatingSystems=objWMIService.ExecQuery_
    ("Select*fromWin32_OperatingSystem")

For
EachobjOperatingSystemincolOperatingSystems
    objOperatingSystem.Win32Shutdown(1)
Next
 
4) ModifySystemStartupDelay

strComputer
="."
Set
objWMIService=GetObject("winmgmts:"_
    &"{impersonationLevel=impersonate}!\\"&strComputer&"\root\cimv2")

Set
colStartupCommands=objWMIService.ExecQuery_
    ("Select*fromWin32_ComputerSystem")

For
EachobjStartupCommandincolStartupCommands
    objStartupCommand.SystemStartupDelay=10
    objStartupCommand.Put_
Next

0 comments:

Post a Comment