The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

dmerida (13) [Avatar] Offline
#1
Is there a way in PowerShell to create new file directories on remote servers using a separate set of credentials? For example:

PS> New-Item -path \remoteserverc$ -name Test -type directory -cred domainusername


This doesn't work because the filesystem provider does not support the use of credentials. Is there a way I can get around this?
dmerida (13) [Avatar] Offline
#2
Re: Creating directories on remote servers
Big thanks to Lee Holmes for providing this answer...pick up his book if it's not in your PowerShell library yet.

PowerShell v 1.0 will let you create directories on network shares with the net use command.

PowerShell v 2.0, which introduces remoting, will let us do just about anything with alternate credentials.

Unfortunately, the folders I'm creating are not going to network shares. Hopefully this helps clear things up for some people though.