View Single Post
Old 06-27-2008   #1 (permalink)
Mike Bailey


 
 

Help with Logon script error

Below is a logon script that I've basically put together from various
other examples. The intention of the script is to map a set of common
drives for my users. The script should check to see if a drive mapping
already exist, if so, then remove it, then map the drive letter back to
what I want. I kow/think that part of it is an attempt to handle
persistent drive letters in Explorer where even after disconnecting the
drive,it still appears in "My Computer"

When I run the script I get the following error:

Line: 11
Char: 1
Error: object required 'objFSO'

Can anyone help? I'm sure this is soemthing simple, but I have basically
no VBS knowlege

Thanks,
Mike


Here is the scrip:

=====================================================================================
Dim WshNet

'*****************
'MAP COMMON DRIVES
'*****************
'
'Note: U: (User Home directory) is mapped in the user profile in Active
Directory

'G: Drive - FS01\App
'************************
If (objFSO.DriveExists("G:" = True)) Then
objNetwork.RemoveNetworkDrive "G:",True,True
End If

If objFSO.DriveExists("G:") Then
Set objReg =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
objReg.DeleteKey HKCU, "Network\" & Left("G:", 1)
Set objReg = Nothing
End If

Set WshNet = WScript.CreateObject("WScript.Network")
WshNet.MapNetworkDrive "G:", "\\fs01\app"
Set WSHNet = Nothing

'S: Drive - Bea2\Users
'************************
If (objFSO.DriveExists("S:" = True)) Then
objNetwork.RemoveNetworkDrive "S:",True,True
End If

If objFSO.DriveExists("S:") Then
Set objReg =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
objReg.DeleteKey HKCU, "Network\" & Left("S:", 1)
Set objReg = Nothing
End If

Set WshNet = WScript.CreateObject("WScript.Network")
WshNet.MapNetworkDrive "S:", "\\bea2\users"
Set WSHNet = Nothing

'I: Drive - FS02\Img
'************************
If (objFSO.DriveExists("I:" = True)) Then
objNetwork.RemoveNetworkDrive "I:",True,True
End If

If objFSO.DriveExists("I:") Then
Set objReg =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
objReg.DeleteKey HKCU, "Network\" & Left("I:", 1)
Set objReg = Nothing
End If

Set WshNet = WScript.CreateObject("WScript.Network")
WshNet.MapNetworkDrive "I:", "\\fs02\img"
Set WSHNet = Nothing
==================================================================================================

End of Script
My System SpecsSystem Spec