• 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.

Windows login script

Homerboy

Lifer
I'm making a simple script maping a few shared network drives


Dim objNetwork, strDrive, objShell, objUNC
Dim strRemotePath, strDriveLetter, strNewName
'
strDriveLetter = "W:"
strRemotePath = "\\dc.domain.local\test share"
strNewName = "TEST"

' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath

' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName

Wscript.Echo "Check : "& strDriveLetter & " for " & strNewName
WScript.Quit


Error I get is:

Object Required: 'NameSpace(...)'
Code: 800A01A8


This is when logging onto the Win2k3 domain via a win2k workstation.
The script runs fine if I run it locally on the Win2k3 server

Any input would be appreciated.
Thanks!
 
What line is it telling you the error stems from? Below is the log in script we use.

This one is for mapping a drive to their username:

Option Explicit
Dim objNetwork
Dim strDriveLetter, strRemotePath, strUserName

strDriveLetter = "H:"
strRemotePath = "\\sahalee\H"


Set objNetwork = WScript.CreateObject("WScript.Network")

strUserName = objNetwork.UserName
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath _
& "\" & strUserName

WScript.Quit
--------------------------------
This one is for a static drive:

Option Explicit
Dim objNetwork, strRemotePath1, strRemotePath2
Dim strDriveLetter1, strDriveLetter2
strDriveLetter1 = "K:"
strDriveLetter2 = "W:"
strRemotePath1 = "\\sahalee\CH Common"
strRemotePath2 = "\\sahalee\Exec_Common"

On Error Resume Next

Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
WScript.Quit

I know they work, but if anyone sees anything wrong with them, let me know.


And Homerboy, I Googled the error, and the little I found suggested a spelling error? I looked over your script and didn't see if right away, I don't know how accurate they were.
 
This will work too

Option Explicit

Dim objNetwork, mDrive, oShell

Set objNetwork = Wscript.CreateObject("Wscript.Network")
objNetwork.MapNetworkDrive "W:", "\\dc.kohnlaw.local\test share"
mDrive = "W:\"
Set oShell = CreateObject("Shell.Application" )
oShell.NameSpace(mDrive).Self.Name = "TEST"
Wscript.quit
 
Back
Top