Question : User Profile Login Script section in Active Directory?

This is actually a two piece question.  One is it possible to run more than one batch file/script in the User Profile: Login Script in Active Directory, or am I limited to one script per user (in the case I already have a script set in the User Profile: Login Script)?  

Second is it possible to assign a script to a Security Group?  Reason being is I have several OUs for separate departments (which I have scripts set in the GP for each department, mostly mapped drives) but have a Security Groups for Committees/Groups that span across several of these departments.  What I would like to do is set up a script to map shortcuts to shared folders for sharing their committee/group data.  Any help is welcome.  

Last thing, I've read in order to right a script to set up a shortcut you actually have to create the shortcut first , then copy that shortcut to the location you want on their computer?  Just a quick example of what I would like to do:

Server folder share path:
D:\Committee Folders\Management Team (Managment Team is shared folder)

What I would like to to create a shortcut to Management Team and place on the members desktop.
So what I would do is create shared folder to hold shorcuts that way the shortcuts aren't located in the shared folder:

D:\Committe Folder Shortcuts\Management Team.lnk (shortcut pointing to the Management Team folder)

Script:
;Delete the mapped drive
net use "T:" /d

;Setup a temp mapped drive for shortcut copy
net use "T:" \\Server\Committtee Folder Shortcuts

;Copy the shortcut if it isn't there
If Not Exist("%Userprofile%\Desktop\Management Team.lnk")
     copy "T:\\Server\Committee Folder Shortcuts\Management Team.lnk"  "%Userprofile%\Desktop"
End IF

;Clean out mapped drive thats not needed
net use "T:" /d

Please let me know if my logic looks right or if anything looks wrong.

Thanks,
Ronnie

Answer : User Profile Login Script section in Active Directory?

'Declares variables used through-out the script

DIM UserDriveLetter
DIM drive
DIM fso
DIM message
UserDriverLetter = "U:"

'Removes previously mapped drives
On error resume next

Set oDrives = WshNetwork.EnumNetworkDrives
For i = 0 to oDrives.Count - 1 Step 2
WshNetwork.RemoveNetworkDrive oDrives.Item(i),true,true
Next


'Maps the User's Home directory

Set WshShell = WScript.CreateObject("WScript.Shell")
Set wshNetwork = CreateObject("WScript.Network")
Set fso = CreateObject("Scripting.FileSystemObject")

wshNetwork.MapNetworkDrive "U:", "\\FILESERVER\" & wshNetwork.Username

'Maps the pre-determined user directories

wshNetwork.MapNetworkDrive "F:", "\\SERVER1\SHARE" & ""
wshNetwork.MapNetworkDrive "H:", "\\SERVER1\ANOTHERSHARE" & ""
wshNetwork.MapNetworkDrive "K:", "\\SERVER4\YETANOTHERSHARE" & ""
wshNetwork.MapNetworkDrive "V:", "\\SERVER1\VIRUSDATSHARE" & ""

'Maps Printers

wshNetwork.AddWindowsPrinterConnection "\\SERVER1\PRINTER2"
wshNetwork.AddWindowsPrinterConnection "\\SERVER2\PRINTER2"
wshNetwork.AddWindowsPrinterConnection "\\SERVER1\PRINTER1"
wshNetwork.AddWindowsPrinterConnection "\\SERVER3\PRINTER5"
wshNetwork.SetDefaultPrinter "\\SERVER1\PRINTER2"


'Runs Time Syncrhonization
WshShell.Run ("\\SERVER\NETLOGON\time.vbs")


'Calls AV update, place where Mcafee DAT files are downloaded daily.
WshShell.Run ("V:\vupdate.exe /SILENT /PROMPT /F")



'Displays Home Directory and Free Space

Sub FindSpace(drive, message)
DIM space
DIM units

space = drive.FreeSpace

if space >= 1073741824 then
 space = Round(space / 1073741824, 2)
 units = "GB"
elseif space >= 1048576 then
 space = Round(space / 1048576, 2)
 units = "MB"
elseif space >= 1024 then
 space = Round(space / 1024, 2)
 units = "KB"
end if

message = message & vbCRLF & "You have " & space & " " & units & " free." & vbCRLF

End Sub

'Displays message to the user, will only display space left if disk quota is used.

message = "User Directory Usage: " & vbCRLF

Function ShowFreeSpace(UserDriveLetter)
   Dim fso, d, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set d = fso.GetDrive(fso.GetDriveName(UserDriveLetter))
   s = "Drive " & UCase(UserDriveLetter) & " - "
   s = s & d.VolumeName   & "
"
   s = s & "Free Space: " & FormatNumber(d.FreeSpace/1024, 0)
   s = s & " Kbytes"
   ShowFreeSpace = s
End Function

MsgBox message, , "Welcome to the Domain, " & wshNetwork.UserName




The time.vbs:

DIM fso
DIM WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = WScript.CreateObject("Scripting.FileSystemObject")

WshShell.Run("%COMSPEC% /c net time \\\\TIMESERVER /set /y")





If you have alot of users, it's better to setup the scripts like luv2smile suggested.  However, if you only deal with alimited amout of users, you can use user profiles.


AC



Random Solutions  
 
programming4us programming4us