Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, February 3, 2010 5:39 PM
anyone know why this doesn't work:
new-psdrive -name dev -PSProvider filesystem -Root \192.68.1.1\f$
"does not exist or is not a folder" is the error... yes, it exists, I can start -> run -> \192.68.1.1\f$, and it opens fine, after prompting for credentials of course. I also tried to supply the -credential parameter, it prompted for my password, but then gave error "the provider does not support the use of credentials"
whats the deal? Do I have to use good old 'net use' instead? I was trying to be all powershelly and what not ;)
All replies (9)
Wednesday, February 3, 2010 8:11 PM âś…Answered
As stated unc path using IP or hostname works fine. I think your problem is just permissions. Unfortunatley, none of the built in providers support the credential parameter with New-PSDrive, so you need to be able to authenticate using the account that is running the command.
Wednesday, February 3, 2010 6:22 PM
If you go through "help new-psdrive -examples", it definitely looks like you can use shares... With v2, there's also a WScript example. Give that a try. I'm wondering if the "$" is confusing the command...
Wednesday, February 3, 2010 6:25 PM
It works for me, but I have the same login on both machines. I don't have another system with shared drives with a different login to test with either. I definitely seems to be credential-related.
You may be aware but an alternative to "net use", and one that is visible and persistent outside of PowerShell is:
$net = New-Object -com WScript.Network
$net.mapnetworkdrive( strLocalName , strRemoteName , [bUpdateProfile ], [strUser ], [strPassword ])
Wednesday, February 3, 2010 6:41 PM
I just tried on a different share without "$", same problem. "net use" works fine... I assume the wscript.network route works also, but I wanted to learn about the powershell way.
does it really not support supplying credentials? or does it just not support taking a 'PS' credential object? I would be very suprised if you can't map drives to systems without specify alternate credentials...
maybe it doesn't like the IP in the UNC path? I don't actually have another destination to test by host name where I am at the moment.
Wednesday, February 3, 2010 6:42 PM
hi wtgreen, thanks for the reply, could you verify for me that using an IP in your unc path works?
Wednesday, February 3, 2010 7:34 PM
With the new-psdrive command, yes:
PS C:\base> new-psdrive -name test2 -PSProvider filesystem -Root \\10.24.23.230\c$
Name Used (GB) Free (GB) Provider Root
test2 FileSystem \\10.24.23.230\c$
This also works:
$net = New-Object -com WScript.Network
$net.mapnetworkdrive( 'Q:', '\10.24.23.230\c$' )
Wednesday, February 3, 2010 9:14 PM
ok, thanks wtgreen.
Wednesday, February 3, 2010 9:15 PM
ok, thanks Mike.
Wednesday, June 9, 2010 10:09 PM
I have just spent an hour messing around with this.
It turned out to be one of those easy-when-you-know-how issues.
I could happily create new psdrives (1 minute):
new-psdrive -name aDrv -psprovider FileSystem -root \aServer\e$\aFolder
What took the figuring out was how to reference it (59 minutes). You need to add a colon:
set-location aDrv: