ProLiant Deployment and Provisioning
1828934 Members
2206 Online
109986 Solutions
New Discussion

Map Drive Script in RDP

 
Jay Bon
New Member

Map Drive Script in RDP

Hi everyone,

So I have a script included in a job that installs an application. In order to install, a drive is mapped to the local machine because local environment variables need to be utilized, and it's a much quicker method than copying the install files over.

So here's the VBScript that I'm using:

-----------------------------------------------
'Map Drive to Install Files

On Error Resume Next

strComputer = "."

Set objWMIService=GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
("Select * From Win32_LogicalDisk Where DeviceID = 'K:'")

If colItems.Count = 0 Then
Set objNetwork = CreateObject("Wscript.Network")
objNetwork.MapNetworkDrive "K:", "\\server1\publicfolder"
End If
-----------------------------------------------

I have tried running it from the RDP server, I have tried manually copying the file to the destination computer and running it there, I have tried creating a .bat file that runs the .vbs file. I have tried the "net use" command to create the mapped drive -- all to no avail.

If I try running them from the job on the RDP server, it doesn't work, but when I run it through remote desktop on the destination computer, they run fine. It would seem to me that it's a rights issue, but I have tested running the jobs with domain administrator rights and local administrator rights from the RDP server.

I'm running Deployment Server 6.8 on a 2K3 server.

Any help in this matter would be greatly appreciated. Thanks.
1 REPLY 1
Gordon Leonard
Honored Contributor

Re: Map Drive Script in RDP

[I'm assuming your test this from a DOS box]
Seems like the RDP server can't find "server1". Try using server1's IP address.