T
Ty Moffett
I have a simple logon script that runs a few 'netsh' commands and a 'net
time' command. The problem (albiet small) is that they each fire off their
own command window and it's a little annoying.
Can they all be run in the same window? The script is below.
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_OperatingSystem",,48)
If objItem.Caption = "Microsoft Windows XP Professional" Then
set WshShell = CreateObject("WScript.Shell")
'Enable TCP port 135 (which is the port that WMI uses).
WshShell.Run "netsh firewall add portopening TCP 135 RemoteAdministration
ENABLE ALL"
'Enable the "File and Printer Sharing" ports on the firewall.
WshShell.Run "netsh firewall set service FILEANDPRINT ENABLE ALL"
'Enable the "Remote Desktop" ports on the firewall.
WshShell.Run "netsh firewall set service REMOTEDESKTOP ENABLE ALL"
'Registry hack that enables remote desktop.
WshShell.Run "regedit /s remotedesktopenable.reg"
End If
'Sync the time.
WshShell.Run "net time \\aristotle /set /yes"
time' command. The problem (albiet small) is that they each fire off their
own command window and it's a little annoying.
Can they all be run in the same window? The script is below.
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_OperatingSystem",,48)
If objItem.Caption = "Microsoft Windows XP Professional" Then
set WshShell = CreateObject("WScript.Shell")
'Enable TCP port 135 (which is the port that WMI uses).
WshShell.Run "netsh firewall add portopening TCP 135 RemoteAdministration
ENABLE ALL"
'Enable the "File and Printer Sharing" ports on the firewall.
WshShell.Run "netsh firewall set service FILEANDPRINT ENABLE ALL"
'Enable the "Remote Desktop" ports on the firewall.
WshShell.Run "netsh firewall set service REMOTEDESKTOP ENABLE ALL"
'Registry hack that enables remote desktop.
WshShell.Run "regedit /s remotedesktopenable.reg"
End If
'Sync the time.
WshShell.Run "net time \\aristotle /set /yes"