Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Login script error

Posted on 2012-04-04
2
Medium Priority
?
651 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
prashanthd earned 1000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
For anyone that has accidentally used newSID with Server 2008 R2 (like I did) and hasn't been able to get the server running again because you were unlucky (as I was) and had no backups - I was able to get things working by doing a Registry Hive rec…
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 walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…

609 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