I’m building an application so that our Service Desk can connect to remote computers and browse the file system to get at logs.
I tried to create a secured credential file but when I read that file and pass its arguments to invoke-item, it won’t work.
Can someone tell me what I’m doing wrong?
This is what I have so far:
$computer = 'somename' $creds = Get-Credential $creds | Export-Clixml -Path "$env:USERPROFILE\AppData\Local\MyCompany\UserCreds.xml" $creds = Import-Clixml -Path "$env:USERPROFILE\AppData\Local\Mycompany\UserCreds.xml" $credObject = New-Object System.Management.Automation.PSCredential -ArgumentList $creds.username, $creds.password Invoke-Item "\\$computer\c$" -Credential $credObject