Den var straks værre :o)
Dette burde "Do the trick"
On Error Resume Next
Set Network = Wscript.CreateObject("Wscript.Network")
Set shell = WScript.CreateObject("WScript.Shell")
StrDomain = Network.UserDomain
StrBruger = Network.Username
struser = network.username
Const ADS_SCOPE_SUBTREE = 2
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk",,48)
For Each objItem in colItems
if mid(objItem.ProviderName,1,2)= "\\" Then
shell.run "%comspec% /c net use " & objitem.name & " /delete /yes",0,True
end If
Next
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT distinguishedName FROM '
LDAP://dc=int,dc=dragsted,dc=com' WHERE objectCategory='user' " & _
"AND sAMAccountName='" & struser & "'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
strresult = lcase(objRecordSet.Fields("distinguishedName").Value)
If InStr(strresult,"ou=domain_instr") <> 0 Then
Network.MapNetworkDrive "M:", ("\\server\InStr\h"), True
Network.MapNetworkDrive "N:", ("\\server\InStr\n"), True
End If
If InStr(strresult,"ou=domain_stud") <> 0 Then
Network.MapNetworkDrive "M:", ("\\server\stud\m"), True
Network.MapNetworkDrive "N:", ("\\server\stud\n"), True
End If
objRecordSet.MoveNext
Loop
/Killer