Jump to content

Mapping C$ drive using variables


 Share

Recommended Posts

Any advice will be greatly appreciated.

1 - I am asking the user for input

$UserID entry is in DOMAIN\USER format (and is admin on target PC)

$Computername has been entered as computername, IP address and \\computername and \\IP address

2 - Mapping the C$ drive of another computer

3 - Copying a file from the same directory as the script to that drive.

So far, I am not able to map the drive successfully. Is there some syntax error in the DRIVEMAPADD line? Something else?

Script is as follows:

$UserID = InputBox ("User Name", "Enter User name", "", "")

$Password = InputBox ("Password", "Enter Password","", "X")

$ComputerName = InputBox ("Computer Name", "Enter Computer Name","", "")

DriveMapAdd ("J:", "$Computername\c$", 0, "$UserID", "$Password")

FileCopy ("@ScriptDir\Filename.txt","J:", 1)

Link to comment
Share on other sites

try

$UserID = InputBox ("User Name", "Enter User name", "", "")
$Password = InputBox ("Password", "Enter Password","", "X")
$ComputerName = InputBox ("Computer Name", "Enter Computer Name","", "")

DriveMapAdd ("J:","\\" & $Computername & "\c$", 0, $UserID, $Password)
FileCopy (@ScriptDir & "\Filename.txt","J:", 1)

you can just enter an IP or Computername with out any slashes

Edited by tlman12
Link to comment
Share on other sites

try

$UserID = InputBox ("User Name", "Enter User name", "", "")
$Password = InputBox ("Password", "Enter Password","", "X")
$ComputerName = InputBox ("Computer Name", "Enter Computer Name","", "")

DriveMapAdd ("J:","\\" & $Computername & "\c$", 0, $UserID, $Password)
FileCopy (@ScriptDir & "\Filename.txt","J:", 1)

you can just enter an IP or Computername with out any slashes

Thanks for the quick response. I will try this when I return t work next week.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...