Solved

Login script error

Posted on 2012-04-04
2
635 Views
Last Modified: 2012-04-04
I am trying to map network drive using the following vb script file on windows 2003 R2 but when user logging in, an error throws that

Object required: NameSpace(...)
Line 14
vbscript runtime error

the code:
Dim objNetwork, strDrive, objShell, objUNC
Dim strRemotePath, strDriveLetter, strNewName

strDriverLetter = "W:"
strRemotePath = "\\home\Home share$"
strNewName = "myFolder"

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

Set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
Set oShellLink = WshShell.CreateShortCut(strDesktop & "\myFolder.lnk")
oShellLink.TargetPath = WScript.ScriptFullName
oShellLink.WindowsStyle = 1
oShellLink.TargetPath = "W:\"
oShellLink.WorkingDirectory = "w:\"
oShellLink.Save

WScript.Quit

Please help me to fix the error.

thanks
0
Comment
Question by:ayha1999
2 Comments
 
LVL 12

Accepted Solution

by:
prashanthd earned 250 total points
ID: 37807295
Can you check if the drive has been mapped successfully?
0
 
LVL 7

Author Closing Comment

by:ayha1999
ID: 37807368
the error was typo. strDriveLetter not strDriverLetter, so it was not mapped.

Thanks
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Learn about cloud computing and its benefits for small business owners.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now