Solved

Login script error

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

A safe way to clean winsxs folder from your windows server 2008 R2 editions
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

690 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