'---------- ARHLOGON.VBS --------------------------------------------------
' Logon script running in GPO for all computers in ARH Network.
'--------------------------------------------------------------------------
' To avoid having different logon scripts for different offices & computers,
' this script will determine your location by querying your IP address
' or from a command line argument. User information and location
' information are then combined to remove old drive mappings, attach
' new drive mappings, update support software, stardardize settings,etc.
' Each section is documented and fairly obvious what is happening.
'
' The script is deployed to the workstations in a GPO in the Active
' Directory ARH-US.COM. Policy name is ARH CUSTOMIZED.
'
' To protect from run-away scripts, this will NOT map drive letters
' if run As ADMINISTRATOR.
'
' Author: Phil Gordemer
'
' Credits:
' Logic, structure and code segments gleaned and used from
' Mark D. MacLachlan, The Spiders Parlor
' Mr Movie
' Bill Paterson
' Tek Tips VB Script Forum
'
' Sub and Parts logic credited to
'
' ARHLOGON /VPN /CS /HQ /NORTH /SILENT /UPDATE /?
'
' /VPN
' Logon is from VPN, assume HQ location
' /CS
' Force CS location
' /HQ
' Force HQ location
' /NORTH
' Force NORTH location
' /SILENT
' No screen display - non interactive
' /UPDATE
' Force update even if registry key exists
' /?
' This help screen
'--------------------------------------------------------------------------
' 12/14/05 V3.0.1
' Remove regedit for Language bar
' 12/14/05 V3.0.0
' Major Restructuring
' New function to test that servers are alive
' Change most sections to react to dead servers
' Change location of TrakPC posting
' 12/08/05 V2.6.7
' Stop creation of PDF Factory for troublshooting
' 12/06/05 V2.6.6
' Add ARH2 ARH3 servers to IE Trusted Zones
' Removed WIND2 1 time update
' Removed ACAD Link 1 time update
' Update printers for new North Server
'-----------------------------------------------------------------------
' NOTES for changes from 1.0.0 to 2.6.5 have been removed to
' archive
'-----------------------------------------------------------------------
On Error Resume Next
Dim WSHShell, WSHNetwork
Dim objFSO, objDomain, objWMI
Dim UserString, UserObj, GroupObj
Dim strHomeShare, strComputer
Dim MSIE, WinDir
Const WaitonReturn = True , NoWaitonReturn = False
Const HideWindow = 0 ,DisplayWindow = 1
Const OverWrite = True
Const Force = True
Const UpdateProfile = True
VPN = False
CS = False
HQ = False
NORTH = False
StayOpen = False
Silent = False
Update = False
UptoDate = False
Administrator = False
Version = "v3.0.1"
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'---------- Check the command line for arguments --------------------------
Set objArgs = WScript.Arguments
For i = 0 To objArgs.Count - 1
strCommandLine = objArgs(i)
Select Case UCase(strCommandLine)
Case "/VPN"
VPN = True
Case "/SILENT"
Silent = True
Case "/CS"
CS = True
Case "/HQ"
HQ = True
Case "/NORTH"
NORTH = True
Case "/UPDATE"
Update = True
Case "/?"
MsgBox "ARHLOGON.VBS" & vbCRLF & _
"Logon script for computers in ARH Network" & vbCRLF & vbCRLF & _
" ARHLOGON /VPN /CS /HQ /NORTH /SILENT /?" & vbCRLF & vbCRLF & _
" /VPN" & vbCRLF & _
" Logon is from VPN, assume HQ location" & vbCRLF & _
" /CS" & vbCRLF & _
" Force CS location" & vbCRLF & _
" /HQ" & vbCRLF & _
" Force HQ location" & vbCRLF & _
" /NORTH" & vbCRLF & _
" Force NORTH location" & vbCRLF & _
" /SILENT" & vbCRLF & _
" No screen display - non interactive" & vbCRLF & _
" /UPDATE" & vbCRLF & _
" Force update even if registry key exists" & vbCRLF & _
" /?" & vbCRLF & _
" This help screen" & vbCRLF & vbCRLF
WScript.Quit
End Select
Next
'---------- Use Internet Explorer to display where we are going -----------
setupMSIE
'---------- Check registry to see last version run ------------------------
RegKeyARH = "HKCU\Software\ARH\LogonCustomization\Version"
If KeyExists (RegkeyARH) Then
If WSHShell.RegRead(RegKeyARH) = Version Then
UptoDate = True
End If
End If
If Update Then UptoDate = False
'---------- Get some local computer information -------------------------
' Get Windows directory location
WinDir = objFSO.GetSpecialFolder(0)
' Get User Profile directory location
UserProfile = WSHShell.ExpandEnvironmentStrings("%UserProfile%")
'---------- Find their OS to determine who is a server or workstation -----
OS2000 = False
OSXP = False
OSXP64 = False
OSServer2003 = False
OSServer2000 = False
WorkStation = False
Server = False
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colOperatingSystems = objWMI.ExecQuery ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem In colOperatingSystems
OSName = objOperatingSystem.Caption
Select Case OSname
Case "Microsoft Windows 2000 Professional"
OS2000 = True
WorkStation = True
Case "Microsoft Windows XP Professional"
OSXP = True
WorkStation = True
Case "Microsoft(R) Windows(R) XP Professional x64 Edition"
OSXP64 = True
WorkStation = True
Case "Microsoft Windows 2000 Server"
OSServer2000 = True
Server = True
Case "Microsoft(R) Windows(R) Server 2003, Standard Edition"
OSServer2003 = True
Server = True
Case Else
showIE "BRed", "<BR><BR>" & OSName
showIE "", "<BR><BR>OS not known, aborting script"
StayOpen = True
Cleanup StayOpen
End Select
Next
'----------Find their location --------------------------------------------
' 192.168.0.x is HQ
' 192.168.1.x is CS
' 192.168.2.x is North
Location = "UNKNOWN"
If CS Then Location = "CS"
If NORTH Then Location = "NORTH"
If HQ Then Location = "HQ"
If VPN Then Location = "HQ"
If Location = "UNKNOWN" Then
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set myobj = objWMI.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each itm In myobj
arrIP = Split(itm.IPAddress(0),".")
If arrIP(0) = 192 And arrIP(1) = 168 Then
If arrIP(2) = 2 Then
Location = "NORTH"
End If
If arrIP(2) = 1 Then
Location = "CS"
End If
If arrIP(2) = 0 Then
Location = "HQ"
End If
End If
Next
End If
If Location = "UNKNOWN" Then
showIE "BRed", "<BR><BR>Location unknown, aborting script"
StayOpen = True
Cleanup StayOpen
End If
'---------- Get information from Active directory -------------------------
' Grab the user name and computer name and home directory, set a flag
' if logged in as Administrator
UserString = UCase(WSHNetwork.UserName)
If UserString = "ADMINISTRATOR" Then
Administrator = True
End If
strComputer = UCase(WSHNetwork.ComputerName)
showIE "Yellow","Connecting "
showIE "BRed", UserString
showIE "Yellow", " on "
showIE "BRed", strComputer
showIE "BRed", "<BR>" & OSName & "<BR>"
showIE "White", "Detected location is " & Location & "<BR>"
Set UserObj = GetObject("WinNT://ARH-NT/" & UserString)
strHomeShare = UCase(UserObj.HomeDirectory)
'---------- Disconnect ALL mapped drives except H: ------------------------
' Need to insert a slight pause between each disconnect to give
' time for the registry to update
showIE "Yellow", "<BR>Removing drives: "
Set clDrives = WshNetwork.EnumNetworkDrives
For i = 0 To clDrives.Count -1 Step 2
If clDrives.Item(i) <> "H:" Then
showIE "",clDrives.Item(i) & " "
WSHNetwork.RemoveNetworkDrive clDrives.Item(i), Force, UpdateProfile
WScript.sleep 100
End If
Next
WScript.sleep 300
'---------- Map drives needed by all --------------------------------------
' Home Drive
showIE "White", "<BR>Mapping Home Drive H: to: "
If objFSO.DriveExists("H:") Then
showIE "", " Already Done"
Else
WSHNetwork.MapNetworkDrive "H:", strHomeShare
showIE "", " " & strHomeShare
End If
'---------- Map Drives by Location ----------------------------------------
' Even though the drive mappings are mostly the same we are seperating them
' and duplicating for more felxibility. Don't map drives if logged in as
' administrator. Check to make sure the server is alive before mapping
' to it
showIE "Yellow", "<BR>Mapping Drives: "
If Not Administrator Then
Select Case Location
Case "HQ"
If IsAlive("ARH1") Then
showIE "", " ARH1"
WSHNetwork.MapNetworkDrive "M:", "\\arh1\CAD-STD"
WSHNetwork.MapNetworkDrive "N:", "\\arh1\vol2"
WSHNetwork.MapNetworkDrive "P:", "\\arh1\fileroom"
WSHNetwork.MapNetworkDrive "S:", "\\arh1\shared"
WSHNetwork.MapNetworkDrive "T:", "\\arh1\temp"
End If
If IsAlive("ARH-CS") Then
showIE "", " ARH-CS"
WSHNetwork.MapNetworkDrive "G:", "\\arh-cs\gis-temp"
WSHNetwork.MapNetworkDrive "J:", "\\arh-cs\specs"
WSHNetwork.MapNetworkDrive "O:", "\\arh-cs\gis-4"
WSHNetwork.MapNetworkDrive "Q:", "\\arh-cs\gis-1"
WSHNetwork.MapNetworkDrive "R:", "\\arh-cs\gis-3"
WSHNetwork.MapNetworkDrive "U:", "\\arh-cs\gis-final"
WSHNetwork.MapNetworkDrive "V:", "\\arh-cs\fileroom"
End If
Case "CS"
If IsAlive("ARH-CS") Then
showIE "", " ARH-CS"
WSHNetwork.MapNetworkDrive "G:", "\\arh-cs\gis-temp"
WSHNetwork.MapNetworkDrive "J:", "\\arh-cs\specs"
WSHNetwork.MapNetworkDrive "O:", "\\arh-cs\gis-4"
WSHNetwork.MapNetworkDrive "Q:", "\\arh-cs\gis-1"
WSHNetwork.MapNetworkDrive "R:", "\\arh-cs\gis-3"
WSHNetwork.MapNetworkDrive "U:", "\\arh-cs\gis-final"
WSHNetwork.MapNetworkDrive "V:", "\\arh-cs\fileroom"
End If
If IsAlive("ARH1") Then
showIE "", " ARH1"
WSHNetwork.MapNetworkDrive "M:", "\\arh1\CAD-STD"
WSHNetwork.MapNetworkDrive "N:", "\\arh1\vol2"
WSHNetwork.MapNetworkDrive "P:", "\\arh1\fileroom"
WSHNetwork.MapNetworkDrive "S:", "\\arh1\shared"
WSHNetwork.MapNetworkDrive "T:", "\\arh1\temp"
End If
If IsAlive("CSIMS01") Then
showIE "", " CSIMS01"
WSHNetwork.MapNetworkDrive "L:", "\\csims01\csdata"
WSHNetwork.MapNetworkDrive "X:", "\\csims01\enterroadinfo"
End If
Case "NORTH"
If IsAlive("ARH-N") Then
showIE "", " ARH-N"
WSHNetwork.MapNetworkDrive "G:", "\\arh-n\vol1"
WSHNetwork.MapNetworkDrive "I:", "\\arh-n\vol1\survey"
WSHNetwork.MapNetworkDrive "M:", "\\arh-n\CAD-STD"
WSHNetwork.MapNetworkDrive "N:", "\\arh-n\vol2"
WSHNetwork.MapNetworkDrive "P:", "\\arh-n\fileroom"
WSHNetwork.MapNetworkDrive "S:", "\\arh-n\shared"
WSHNetwork.MapNetworkDrive "T:", "\\arh-n\temp"
WSHNetwork.MapNetworkDrive "W:", "\\arh-n\wind2"
End If
End Select
Else
showIE "", "Skipped as ADMINISTRATOR"
End If
'---------- Map Printers by Location --------------------------------------
' Map printers for workstations only
'
'Remove a specific printer
' WSHNetwork.RemovePrinterConnection "\\Server\PrinterName", Force, UpdateProfile
''Install Printers
' WSHNetwork.AddWindowsPrinterConnection "\\Server\PrinterName"
'Set Default Printer
' WSHNetwork.SetDefaultPrinter "\\ServerName\PrinterName"
'
showIE "White", "<BR>Mapping Printers: "
If Workstation Then
Select Case Location
Case "HQ"
If IsAlive("ARH1") Then
showIE "", " HQ - 7 Printers: "
WSHNetwork.AddWindowsPrinterConnection "\\ARH1\HP3550"
' WSHNetwork.AddWindowsPrinterConnection "\\ARH1\PDFFACT2"
WSHNetwork.AddWindowsPrinterConnection "\\ARH1\4plus"
WSHNetwork.AddWindowsPrinterConnection "\\ARH1\HP4-Sur"
WSHNetwork.AddWindowsPrinterConnection "\\ARH1\HP5M"
WSHNetwork.AddWindowsPrinterConnection "\\ARH1\HP5N-Muni"
WSHNetwork.AddWindowsPrinterConnection "\\ARH1\Kyoceracolor"
WSHNetwork.AddWindowsPrinterConnection "\\ARH1\LJ2200-Admin"
End If
Case "CS"
If IsAlive("ARH-CS") Then
showIE "", " CS - 8 Printers: "
WSHNetwork.AddWindowsPrinterConnection "\\ARH-CS\HP5-CS"
' WSHNetwork.AddWindowsPrinterConnection "\\ARH-CS\PDFFACT2"
WSHNetwork.AddWindowsPrinterConnection "\\ARH-CS\HP5M_RECEPT"
WSHNetwork.AddWindowsPrinterConnection "\\ARH-CS\TOSHIBA"
WSHNetwork.AddWindowsPrinterConnection "\\ARH-CS\CP1700"
WSHNetwork.AddWindowsPrinterConnection "\\ARH-CS\TCS-400MF"
WSHNetwork.AddWindowsPrinterConnection "\\ARH-CS\hp1055cm"
WSHNetwork.AddWindowsPrinterConnection "\\ARH-CS\HP5M-CS"
WSHNetwork.AddWindowsPrinterConnection "\\ARH-CS\Kyocera Mita KM-C850 KX"
End If
Case "NORTH"
If IsAlive("ARH-NORTH") Then
showIE "", " North - 6 Printers"
WSHNetwork.AddWindowsPrinterConnection "\\ARH-NORTH\HP1050C"
WSHNetwork.AddWindowsPrinterConnection "\\ARH-NORTH\KM1650"
WSHNetwork.AddWindowsPrinterConnection "\\ARH-NORTH\CP1700"
WSHNetwork.AddWindowsPrinterConnection "\\ARH-NORTH\HP755CM"
WSHNetwork.AddWindowsPrinterConnection "\\ARH-NORTH\MAGIC2200"
'WSHNetwork.AddWindowsPrinterConnection "\\ARH-NORTH\PDFFACT2"
End If
End Select
Else
showIE "", " Skipped as SERVER"
End If
'---------- Setup MS Office Paths to local server---------------------------
' Office templates are stored on local server in each office. Since a computer
' may be built in one office and sent to another, reset the shared templates
' location for where the computer is located. Note: if the SharedTemplates was
' never set on a computer, then the key won't exist, check for another key
' in the same folder.
showIE "Yellow", "<BR>Customizing MS Office: "
' Registry Key for Office 2003
RegKey1 = "HKCU\Software\Microsoft\Office\11.0\Common\General\Templates"
RegKey2 = "HKCU\Software\Microsoft\Office\11.0\Common\General\SharedTemplates"
If KeyExists (RegKey1) Then
Select Case Location
Case "HQ"
showIE "", "HQ OFFICE 2003"
WshShell.RegWrite Regkey2, "N:\ARH Templates", "REG_EXPAND_SZ"
Case "CS"
showIE "", "CS OFFICE 2003"
WshShell.RegWrite RegKey2, "Q:\ARH Templates", "REG_EXPAND_SZ"
Case "NORTH"
showIE "", "NORTH OFFICE 2003"
WshShell.RegWrite Regkey2, "G:\ARH Templates", "REG_EXPAND_SZ"
End Select
End If
' Registry Key for Office XP
RegKey1 = "HKCU\Software\Microsoft\Office\10.0\Common\General\Templates"
RegKey2 = "HKCU\Software\Microsoft\Office\10.0\Common\General\SharedTemplates"
If KeyExists (Regkey1) Then
Select Case Location
Case "HQ"
showIE "", "HQ Office XP"
WshShell.RegWrite RegKey2, "N:\ARH Templates", "REG_EXPAND_SZ"
Case "CS"
showIE "", "CS Office XP"
WshShell.RegWrite RegKey2, "Q:\ARH Templates", "REG_EXPAND_SZ"
Case "NORTH"
showIE "", "NORTH Office XP"
WshShell.RegWrite RegKey2, "G:\ARH Templates", "REG_EXPAND_SZ"
End Select
End If
'---------- Actions based On group memberships ----------------------------
showIE "White", "<BR>Activating group items: "
For Each GroupObj In UserObj.Groups
Select Case UCase(GroupObj.Name)
Case "ADMINISTRATORS"
showIE "", "ADMINISTRATORS"
End Select
Next
'---------- Actions based on Computer name --------------------------------
showIE "Yellow", "<BR>Activating computer items: "
Select Case UCase (strComputer)
Case "DELL67"
showIE "","DELL67 default printer HP4"
WSHNetwork.SetDefaultPrinter "\\ARH1\HP5M"
Case Else
showIE "", "None "
End Select
'---------- Check they have all the support products ----------------------
showIE "White", "<BR>Checking HelpDesk Support Products"
' Create the Help Desk IE shortcut
strShortcut = WSHShell.SpecialFolders("Desktop") & "\ARH Helpdesk.lnk"
If Not objFSO.FileExists(strShortcut) Then
Set oUrlLink = WshShell.CreateShortcut(strShortcut)
oUrlLink.TargetPath = "
oUrlLink.Save
End If
' Make sure inventory program is on their computer
If Not objFSO.FileExists("C:\trakpc.exe") Then
Select Case Location
Case "HQ"
objFSO.CopyFile "\\services-hq\disks\helpdesk\trakpc.exe", "C:\", OverWrite
Case "CS"
objFSO.CopyFile "\\services-cs\disks\helpdesk\trakpc.exe", "C:\", OverWrite
Case "NORTH"
objFSO.CopyFile "\\services-north\disks\helpdesk\trakpc.exe", "C:\", OverWrite
End Select
End If
If objFSO.FileExists("C:\Program Files\Autodesk Land Desktop 2006\acad.exe") Then
strShortcut2 = WSHShell.SpecialFolders("Desktop") & "\Update CAD.lnk"
If Not objFSO.FileExists(strShortcut2) Then
Set oUrlLink = WshShell.CreateShortcut(strShortcut2)
oUrlLink.TargetPath = "M:\ARHCAD2006\SETUP\UpdateCAD.vbs"
ourlLink.IconLocation = "C:\Program Files\Autodesk Land Desktop 2006\AcadLand.ico"
oUrlLink.Save
End If
End If
'---------- Run TRAKPC Inventory Program ----------------------------------
' Trakpc runs on the local computer and does a WMI inventory of the
' computer and uploads the results to the helpdesk site. Create a .cmd
' file to run the program, do not run it directly as it needs the
' cmd environment variables.
showIE "Yellow", "<BR>Running HelpDesk Inventory: "
Set objFile = objFSO.CreateTextFile("c:\invent.cmd", OverWrite)
objFile.WriteLine "C:"
objFile.WriteLine "CD\"
objFile.WriteLine "C:\trakpc.exe c:\ /q /u""
objFile.Writeline "EXIT"
objFile.Close
WSHShell.Run "c:\invent.cmd", HideWindow , NoWaitonReturn
'showIE "", " Finished "
'---------- Create Standards & Write Registry Keys ------------------------
' Only run standards and regedits if ARH logon key does not match current version
showIE "White", "<BR>Standards Updates: "
If Not UptoDate Then
' Set OS Registered Organization to ARH Associates
WSHShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization", "ARH Associates","REG_SZ"
' SET OS Registerd Owner to computer name
WSHShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOwner", strComputer,"REG_SZ"
If OSXP Then
' Add Domain Users to the Local Administrators group (Needed for ACAD and ARCMAP)
WshShell.Run "net localgroup ""Administrators"" ""ARH-NT\Domain Users"" /add", HideWindow, WaitonReturn
' Turn off Error reporting
wshShell.RegWrite "HKLM\Software\Microsoft\PCHealth\ErrorReporting\DoReport", 0, "REG_DWORD"
wshShell.RegWrite "HKLM\Software\Microsoft\PCHealth\ErrorReporting\ShowUI", 0, "REG_DWORD"
wshShell.RegWrite "HKLM\Software\Microsoft\PCHealth\ErrorReporting\IncludeKernelFaults", 0, "REG_DWORD"
wshShell.RegWrite "HKLM\Software\Microsoft\PCHealth\ErrorReporting\IncludeMicrosoftApps", 0, "REG_DWORD"
wshShell.RegWrite "HKLM\Software\Microsoft\PCHealth\ErrorReporting\IncludeWindowsApps", 0, "REG_DWORD"
' Turn off XP Windows setting started tour
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Tour\RunCount", 0, "REG_DWORD"
' Turn off XP .net password setup
WshShell.RegWrite "HKCU\Software\Microsoft\MessengerService\PassportBalloon", 10, "REG_BINARY"
' IE6 Add *.arh-us.com SP2 Popup Blocker
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\New Windows\Allow\*.arh-us.com", 0, "REG_BINARY"
End If
' Explorer Speed up browsing by not checking scheduled tasks
RegKey1 = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\{D6277990-4C6A-11CF-8D87-00AA0060F5BF}\"
If KeyExists(Regkey1) Then
WshShell.RegDelete RegKey1
End If
' Explorer File Manager - Disable thumbnail cache
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\DisableThumbnailCache", 1, "REG_DWORD"
' Explorer File Manager - show hidden files and folders
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", 1, "REG_DWORD"
' Explorer File Manager - show operating system files
WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\SuperHidden", 1,"REG_DWORD"
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", 1, "REG_DWORD"
' Explorer File Manager - show file extensions
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", 0, "REG_DWORD"
' Explorer File Manager - show system files
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\WebViewBarricade", 1, "REG_DWORD"
' Explorer File Manager - Command Prompt Here
WshShell.RegWrite "HKCR\Folder\Shell\MenuText\Command\", "cmd.exe /k cd " & Chr(34) & "%1" & Chr(34)
WshShell.RegWrite "HKCR\Folder\Shell\MenuText\", "Command Prompt Here"
' IE6 Cache settings to 10 MB
WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Content\CacheLimit", 10240,"REG_DWORD"
WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Content\CacheLimit", 10240,"REG_DWORD"
' IE6 History to 5 days
WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Url History\DaysToKeep", 5,"REG_DWORD"
' IE6 No Update check
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\Main\NoUpdateCheck", 1,"REG_DWORD"
' IE6 Do not reuse windows
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\Main\AllowWindowReuse", 0,"REG_DWORD"
' IE6 Increase download limit to 10
WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\MaxConnectionsPer1_0Server", 10,"REG_DWORD"
WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\MaxConnectionsPerServer", 10,"REG_DWORD"
' IE6 Add servers to Trusted Zone
wshshell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\services-cs\file",2,"REG_DWORD"
wshshell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\services-hq\file",2,"REG_DWORD"
wshshell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\services-north\file",2,"REG_DWORD"
wshshell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\arh1\file",2,"REG_DWORD"
wshshell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\arh2\file",2,"REG_DWORD"
wshshell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\arh3\file",2,"REG_DWORD"
wshshell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\arh-north\file",2,"REG_DWORD"
wshshell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\arh-cs\file",2,"REG_DWORD"
wshshell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\helpdesk\file",2,"REG_DWORD"
' Rename My Computer to Computer Hostname
RenameMyComputer
ShowIE "", " Updated"
Else
ShowIE "", " Skipped"
End If
'--------- One Time Updates -----------------------------------------------
' Here is where to put 1 time updates, Program installs, things that can
' be removed once run once.
'
showIE "BRed", "<BR><BR>Updates: "
'
' Wind2 update and move. Only once per machine, so store key in
' HKLM instead of per user HKCU
' This entry can be removed after November 1, 2005
'If Not KeyExists ("HKLM\Software\ARH\LogonCustomization\Wind2Update") Then
' If objFSO.FileExists(WinDir & "\wind2.ini") Then
' ShowIE "", " WIND2 Update <BR>"
' ShowIE "", "This update will take 30 seconds"
' Select Case Location
' Case "HQ"
' objFSO.CopyFile "\\services-hq\disks\Wind2_Setup\Wind2.ini", WinDir & "\", OverWrite
' Case "CS"
' objFSO.CopyFile "\\services-cs\disks\Wind2_Setup\Wind2.ini", WinDir & "\", OverWrite
' Case "NORTH"
' ' Do not replace North office file yet, just put the marker there for now
' End Select
' End If
' WshShell.RegWrite "HKLM\Software\ARH\LogonCustomization\Wind2Update", Date, "REG_SZ"
'End If
'---------- Thats all folks -----------------------------------------------
' Write version of script run to Registry, then getout.
WshShell.RegWrite RegkeyARH, Version, "REG_SZ"
showIE "BBlack", "<BR>" & String(20, Chr(183)) & "Done!" & String(20, Chr(183))
WScript.Sleep 4000
Cleanup StayOpen
'---------- Subroutines ---------------------------------------------------
Sub Cleanup (StayOpen)
'----------House cleaning and get out ----------------------------------
If Not StayOpen Then
MSIE.Quit
End If
Set UserObj = Nothing
Set WSHNetwork = Nothing
Set WSHSHell = Nothing
Set MSIE = Nothing
Set objFSO = Nothing
Set objWMI = Nothing
WScript.quit
End Sub
Sub setupMSIE
'----------Setup IE to display what we are doing -----------------------
' Remember to DIM MSIE in main program
' MSIE.Document.Write "xxx" writes line using HTML
' MSIE.Quit closes IE Window
'-----------------------------------------------------------------------
If Silent Then Exit Sub
Set MSIE = CreateObject("InternetExplorer.Application")
MSIE.Navigate "About:Blank"
MSIE.Toolbar = False
MSIE.StatusBar = False
MSIE.Resizable = True
Do
WScript.sleep 100
Loop While MSIE.Busy
SWidth = MSIE.Document.ParentWindow.Screen.AvailWidth
SHeight = MSIE.Document.ParentWindow.Screen.AvailHeight
MSIE.Width = SWidth/2
MSIE.Height = SHeight/1.5
MSIE.Left = (SWidth - MSIE.Width)/2
MSIE.Top = (SHeight - MSIE.Height)/2
MSIE.Visible = True
MSIE.Document.Write "<html><title>ARH Network Logon " & Version & " </TITLE>"
MSIE.Document.Write "<body text=""#FFFF00"" bgcolor=""#00CC00"">"
End Sub
Sub showIE (strColor,strText)
'---------- Write strText to IE display --------------------------------
If Silent Then Exit Sub
Select Case strColor
Case "Yellow"
showColor = "<font color=""#FFFF00"">"
Case "White"
showColor = "<font color=""#FFFFFF"">"
Case "Red"
showColor = "<font color=""#FF0000"">"
Case "BRed"
showColor = "<font color=""#FF0000""><B>"
Case "Black"
showColor = "<font color=""#000000"">"
Case "BBlack"
showColor = "<font color=""#000000""><B>"
End Select
MSIE.Document.write showColor & strText & " </B>"
End Sub
Sub RenameMyComputer
'---------- Rename My Computer to computer hostname --------------------
Const MY_COMPUTER = &H11&
Set objNetwork = CreateObject("Wscript.Network")
objComputerName = objNetwork.ComputerName
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_COMPUTER)
Set objFolderItem = objFolder.Self
objFolderItem.Name = objComputerName
Set objNetwork = Nothing
Set objShell = Nothing
End Sub
Function KeyExists (KeytoFind)
' Test to see if Registry Key exists before acting on it
Dim KeyTest
Set objShell = CreateObject("WScript.Shell")
On Error Resume Next
KeyTest = objShell.RegRead (KeytoFind)
If err <> 0 Then
KeyExists = False
Else
KeyExists = True
End If
Set objShell = Nothing
End Function
Function IsAlive(strHost)
' Test to see if host or url is alive through PING
Set objShell = CreateObject("WScript.Shell")
IsAlive = Not CBool(objShell.run("ping -n 1 " & strHost,0,True))
Set objShell = Nothing
End Function