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
Solved

Login script error

Posted on 2012-04-04
2
643 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Learn about cloud computing and its benefits for small business owners.
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 the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

829 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