Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $username = "domainusername"
- $password = "Welcome1234$"
- $secstr = New-Object -TypeName System.Security.SecureString
- $password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
- $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
- Invoke-Command -Credential $cred -Computer VM1{
- New-Item \VM2sapmntSIDSYSprofiletest.txt -ItemType file
- }
- Access to the path '\vue2dvpahs5sapmntHS5SYSprofiletest.txt' is denied.
- + CategoryInfo : PermissionDenied: (\vue2dvpahs5s...rofiletest.txt:String) [New-Item], UnauthorizedAccessException
- + FullyQualifiedErrorId : NewItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.NewItemCommand
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement