![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Mapping Network Drive With Username & Password Does this look correct for mapping a network drive and passing the correct username and password along with it for authentication? $net = New-Object -ComObject WScript.Network $net.MapNetworkDrive( "X:", "\\servername\share", "true", "<username>", "PASSWORD") |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Mapping Network Drive With Username & Password Replace True with $true Shay http://scriptolog.blogspot.com Quote: > Does this look correct for mapping a network drive and passing the > correct username and password along with it for authentication? > > $net = New-Object -ComObject WScript.Network > $net.MapNetworkDrive( "X:", "\\servername\share", "true", > "<username>", > "PASSWORD") |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Mapping Network Drive With Username & Password Hello Jason, Quote: > Does this look correct for mapping a network drive and passing the > correct username and password along with it for authentication? > > $net = New-Object -ComObject WScript.Network > $net.MapNetworkDrive( "X:", "\\servername\share", "true", > "<username>", > "PASSWORD") $cred = get-credential "user" $domain = "." $user = $cred.UserName $net = New-Object -com WScript.Network $pwd = $cred.Password $drive = "F:" $path = "\\server\share"; $net.RemoveNetworkDrive($drive) $net.mapnetworkdrive($drive, $path, "true", $user, $cred.GetNetworkCredential().Password) Karl |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Mapping Network Drive With Username & Password OK, it works if I use my username and password and I am currently logged in. When I try to access a share I dont' have access to, it gives me an error even if I put in the username and password for the person who has access. I want this to run in a script each night without somebody being logged into the machine to copy log files over to a network share on another machine. Any more ideas? I know have: $net = New-Object -ComObject WScript.Network $net.MapNetworkDrive( "N:", "\\servername\share", "$true", "USERNAME", "PASSWORD") "Shay Levi" wrote: Quote: > Replace True with $true > > Shay > http://scriptolog.blogspot.com > > > Quote: > > Does this look correct for mapping a network drive and passing the > > correct username and password along with it for authentication? > > > > $net = New-Object -ComObject WScript.Network > > $net.MapNetworkDrive( "X:", "\\servername\share", "true", > > "<username>", > > "PASSWORD") > > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Mapping Network Drive With Username & Password I might also add that this is going to a Linux password network storage device that has its own username and password that I need to supply to connect to it. I can connect to it fine going through the RUN command and giving it the path, the login box pops up, I put in the username and password and I connect. It doesn't use domain authentication like domainname\username, just a straight username and password Just thought I would give some more info if anybody has any ideas. "Shay Levi" wrote: Quote: > Replace True with $true > > Shay > http://scriptolog.blogspot.com > > > Quote: > > Does this look correct for mapping a network drive and passing the > > correct username and password along with it for authentication? > > > > $net = New-Object -ComObject WScript.Network > > $net.MapNetworkDrive( "X:", "\\servername\share", "true", > > "<username>", > > "PASSWORD") > > |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Mapping Network Drive With Username & Password I cant test it right now but try to remove the double quotes, use only $true (though it's used only for permanant mapping) Shay http://scriptolog.blogspot.com Quote: > OK, it works if I use my username and password and I am currently > logged in. When I try to access a share I dont' have access to, it > gives me an error even if I put in the username and password for the > person who has access. > > I want this to run in a script each night without somebody being > logged into the machine to copy log files over to a network share on > another machine. Any more ideas? > > I know have: > > $net = New-Object -ComObject WScript.Network > $net.MapNetworkDrive( "N:", "\\servername\share", "$true", "USERNAME", > "PASSWORD") > "Shay Levi" wrote: > Quote: >> Replace True with $true >> >> Shay >> http://scriptolog.blogspot.com Quote: >>> Does this look correct for mapping a network drive and passing the >>> correct username and password along with it for authentication? >>> >>> $net = New-Object -ComObject WScript.Network >>> $net.MapNetworkDrive( "X:", "\\servername\share", "true", >>> "<username>", >>> "PASSWORD") |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| backup to a network drive is asking for username and password...whatusername and password? | Vista General | |||
| Logon Username & Password Fails on At Work Network | Vista networking & sharing | |||
| Home Network password and username | Vista networking & sharing | |||
| Mapping drive save password option | Vista security | |||
| Mapping Network Drive username | Vista networking & sharing | |||