• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

syntax for logon script

imported_JFG

Senior member
In a windows enviornment, how do I map a persistent drive. I want the script to only map the drive to a specific OU and if they already have a drive mapping for that letter, delete their mapping and add what's in the script.

Thanks
 
I've never dealt w/ accounts w/ more than 1 logon script, but this is what I'd use:
net use DriveLetter: \\ComputerName\Sharename /delete
net use DriveLetter: \\ComputerName\Sharename /persistent:yes

Do a net use /? for other available options
 
Originally posted by: Cooky
net use DriveLetter: \\ComputerName\Sharename /delete

use a >nul at the end of the command, so that when it errors (because they do NOT have a drive mapping), it won't hang up the script.
 
Here is what I use in VBScript, you should be able to modify it to make it do what you want.

Dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
Dim hasKdrive
hasKdrive = false
' Check if we have a K drive
Set objNetworkDrives = objNetwork.EnumNetworkDrives
For each objDrive in objNetworkDrives
if objDrive = "K:" then
hasKdrive = true
end if
next
' If not, then map it
if hasKdrive = false then
objNetwork.MapNetworkDrive "K:", "\\server\share"
end if
 
Back
Top