Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Using New-Item with credentials

$
0
0

I've not found the help I need on this one.  I'm attempting to create a folder on a remote machine using the IP address and using credentials.  The sniplet I have is:

$username = 'user\someuser'
$password = 'Some Password'
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
new-item -itemtype directory -path "\\123.45.67.890\c$\Junk" -credential $cred -force

This seems to be an incorrect syntax - as well as several others I've attempted.  Has anyone insight on this?

Thx - kgkidd


kgkidd


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>