I'm still unable to resolve this issue. Does anyone know how to force a
re-install of Windows Scripting 5.7 or how to remove it? Having studied the
processes from start to finish, the cscript.exe files get to over 100Mb each
when nearly completed.
top 10 processes taken from a task manager snapshot, ordered by Mem Usage at
the point the popup message appears from the map drives script below ... by
this point the login process is nearly over.
Image Name User Name CPU Mem Usage
cscript.exe Administrator 01 114,096K
cscript.exe Administrator 01 111,392K
svchost.exe 01 7,088K
exlplorer.exe 01 4,772K
wmiprvse.exe 00 3,180K
wuauclt.exe SYSTEM 00 2,896K
spoolsv.exe 00 2,124K
lsass.exe 00 2,108K
taskmgr.exe 00 1,940K
FrameworkServic...
This is the login script (all text names removed and replaced with <>
template) ...
On Error Resume Next
Set objShell = WScript.CreateObject("WScript.Shell")
Set objNet = WScript.CreateObject("WScript.Network")
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
' Map S: to Shared data
' Map T: to Shared documents
' Map Z: to Users network data
' Remove any existing mapped drives
If (objFSO.DriveExists("S:") = True) Then
objNet.RemoveNetworkDrive "S:", True, True
End If
If (objFSO.DriveExists("T:") = True) Then
objNet.RemoveNetworkDrive "T:", True, True
End If
If (objFSO.DriveExists("Z:") = True) Then
objNet.RemoveNetworkDrive "Z:", True, True
End If
' Map new drives
objNet.MapNetworkDrive "S:", "\\<Server Name>\<Shared Data>"
objNet.MapNetworkDrive "T:", "\\<Server Name>\<Shared Docs>"
Select Case objNet.UserName
Case "<User A>"
objNet.MapNetworkDrive "Z:", "\\<Server Name>\<Home A>"
Case "<User B>"
objNet.MapNetworkDrive "Z:", "\\<Server Name>\<Home B>"
Case "<User C>"
objNet.MapNetworkDrive "Z:", "\\<Server Name>\<Home C>"
Case "<User D>"
objNet.MapNetworkDrive "Z:", "\\<Server Name>\<Home D>"
Case "<User E>"
objNet.MapNetworkDrive "Z:", "\\<Server Name>\<Home E>"
Case Else
objNet.MapNetworkDrive "Z:", "\\<Server Name>\" & objNet.UserName
End Select
objShell.PopUp "Welcome to <Name> Network", 5, "Map network drives", 64
set objNet = NOTHING
set objShell = NOTHING
And the Add Printers script ...
On Error Resume Next
' Get current computer name and location
Set objPC = WScript.CreateObject("Shell.LocalMachine")
strName = objPC.MachineName
strLoc = GetLocation(strName)
' Dont run this script on the server
If strName = "<Server Name>" Then
WScript.Quit(1)
End If
' Create objects
Set objShell = WScript.CreateObject("WScript.Shell")
Set objNet = WScript.CreateObject("WScript.Network")
' Define printers
'
objNet.AddWindowsPrinterConnection "\\<Server Name>\HP3600"
objNet.AddWindowsPrinterConnection "\\<Server Name>\HP3600I"
objNet.AddWindowsPrinterConnection "\\<Server Name>\HPCM1017"
objNet.AddWindowsPrinterConnection "\\<Server Name>\HP2500n"
' Select nearest printer to known location as default printer
'
Select Case StrLoc
Case "<Location 1>"
objNet.SetDefaultPrinter "\\<Server Name>\HP3600I"
Case "<Location 2>"
objNet.SetDefaultPrinter "\\<Server Name>\HPCM1017"
Case "<Location 3>"
objNet.SetDefaultPrinter "\\<Server Name>\HP2500n"
Case "<Location 4>"
objNet.SetDefaultPrinter "\\<Server Name>\HP3600"
End Select
set objNet = NOTHING
set objShell = NOTHING
' Functions
' =========
Function GetLocation(strComputer)
Dim adoCommand, adoConnection, strBase, strFilter, strAttributes
Dim objRootDSE, strDNSDomain, strQuery, adoRecordset, strLoc
' Setup ADO objects.
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection
' Search entire Active Directory domain.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"
' Filter on computer name
strFilter = "(&(objectCategory=computer)(cn=" & strComputer & "))"
' Comma delimited list of attribute values to retrieve.
strAttributes = "Location"
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 10
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
' Return location of computer
GetLocation = adoRecordset.Fields("Location").Value
' Clean up.
adoRecordset.Close
adoConnection.Close
End Function
To my mind, that's not a bunch of complicated scripts, so why do they take
up so much memory?