OK, here you go these two scripts should be a big help for you. The first can bu used to change the value in the ini file on each workstation.
The second is my login script that I use. As you will see from the code, it can disconenct existing mappings, reconnect drives and also be used to recreate printer connections as well as delete the old printer connection. All from the comfort of your desk.
Code:
Const ForReading = 1
Const ForWriting = 2
Const ReadOnly = 1
Dim fso, fsoFile, fsoTextStream, strOldBootIni, strnewBootIni, bToggledReadOnlyAttribute,iniPath
Set fso = CreateObject("Scripting.FileSystemObject")
'Edit this line with the ini Path and file name
iniPath = "C:\Windows\module.ini"
Set fsoFile = fso.GetFile(iniPath)
bToggledReadOnlyAttribute = False
If fsoFile.Attributes And ReadOnly Then
fsoFile.Attributes = fsoFile.Attributes - ReadOnly
bToggledReadOnlyAttribute = True
End If
Set fsoTextStream = fso.OpenTextFile(iniPath, ForReading)
strOldBootIni = fsoTextStream.ReadAll
fsoTextStream.Close
'Here is where you specify what the old text is and what the new text is
'In this example I am changing COMMPOLLSIZE=ON to OFF
strNewBootIni = Replace(strOldBootIni, "COMMPOLLSIZE=On", "COMMPOLLSIZE=Off")
Set fsoTextStream = fso.OpenTextFile(iniPath, ForWriting)
fsoTextStream.Write strNewBootIni
fsoTextStream.Close
If bToggledReadOnlyAttribute = True Then
fsoFile.Attributes = fsoFile.Attributes + ReadOnly
End If
Logon Script
[script]
'==========================================================================
'
' NAME: LogonScript.vbs
'
' AUTHOR: Mark D. MacLachlan, The Spider's Parlor
' URL :
' DATE : 4/10/2003
'
' COMMENT: Enumerates current users' group memberships in given domain.
'
'==========================================================================
ON ERROR RESUME NEXT
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
'Edit the next line with your domain name
DomainString = "DomainName"
UserString = WSHNetwork.UserName
'Bind to the user object to get user name and check for group memberships later
Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)
'Synchronizes the time with Server our NTP Server
WSHShell.Run "NET TIME \\Server /set /y"
'Disconnect any drive mappings as needed.
WSHNetwork.RemoveNetworkDrive "F:"
'Give the PC time to do the disconnect, wait 300 milliseconds
wscript.sleep 300
'Map drives needed by all
WSHNetwork.MapNetworkDrive "U:", "\\server\users",True
WSHNetwork.MapNetworkDrive "X:", "\\server\executables",True
'Now check for group memberships and map appropriate drives
For Each GroupObj In UserObj.Groups
Select Case GroupObj.Name
'Check for group memberships and take needed action
'In this example below, ADMIN and WORKERB are groups.
Case "Admin"
WSHNetwork.MapNetworkDrive "w:", "\\Server\Admin Stuff",True
Case "WorkerB"
WSHNetwork.MapNetworkDrive "w:", "\\Server\Shared Documents",True
End Select
Next
'Remove Printers
WshNetwork.RemovePrinterConnection "\\Server\LaserJet"
'Install Printers
WSHNetwork.AddWindowsPrinterConnection "\\Server\HP5si"
'Clean Up Memory We Used
set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing
'Quit the Script
wscript.quit
[/script]
I hope you find this post helpful. Please let me know if it was.
Regards,
Mark