SubnetJO
Guest
|
Posted:
Fri Jan 07, 2005 6:31 pm Post subject:
RE: Group drive mapping.......login scripts |
|
|
The sample logon script below mapps file-shares and printer-shares from any
server on a user "group belonging" criteria.
Replace the sample names included in the "<...>" brachets with your domain
name, group names, server names, share names...
It should be close what you need.
The script is a portion I wrote for my network, rewrited to work "stand
alone" and to translate into english.
I tested it against my enviroment and works fine.
Enviroment IS NOT AD domain, is NT4 domain, but is you use the NetbiosName
of domain it should work well.
If not, just modify the line to "attach" the domain...
[script starts here]
DomNBTname="<Domain Name>"
set obj_UBG_Dictionary=CreateObject("Scripting.Dictionary")
Set WshNetwork = CreateObject("WScript.Network")
DomPrefixBytes= Len(DomNBTname) + 2
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colComputer = objWMIService.ExecQuery ("Select * from
Win32_ComputerSystem")
For Each objComputer in colComputer
cu = Mid(objComputer.UserName,DomPrefixBytes)
Next
dim groupcouter
groupcounter = 1
set objDomain = GetObject("WinNT://" & DomNBTname)
objDomain.Filter = Array("group")
For Each objGroup In objDOmain
For Each objUser in objGroup.Members
If objUser.name = cu Then
obj_UBG_Dictionary.Add groupcounter, objGroup.Name
wscript.echo obj_UBG_Dictionary.Item(groupcounter)
groupcounter = groupcounter + 1
End If
Next
Next
for i = 1 to obj_UBG_Dictionary.Count
select case obj_UBG_Dictionary.Item(i)
case "<SampleGroup1>"
WshNetwork.MapNetworkDrive "<letter>:",
"\\<FileServerName>\<FileShareName>"
WshNetwork.AddWindowsPrinterConnection
"\\<PrinterServerName>\<PrinterShareName>"
case "<SampleGroup2>"
WshNetwork.MapNetworkDrive "<letter>:",
"\\<FileServerName>\<FileShareName>"
WshNetwork.AddWindowsPrinterConnection
"\\<PrinterServerName>\<PrinterShareName>"
case "<SampleGroup3>"
WshNetwork.MapNetworkDrive "<letter>:",
"\\<FileServerName>\<FileShareName>"
WshNetwork.AddWindowsPrinterConnection
"\\<PrinterServerName>\<PrinterShareName>"
End select
[end of script]
I hope this can help.
Bye,
SubnetJO
Italy |
|