How to create a credential of my current user in PowerShell (without prompt)?
I invoke a remote script with a service account credential (on SCCM server), I would like to send it my current credential because this remote script needs my local credential to write on my local hard drive (during mastering). Both computers are in same domain, but my service account is not allowed to write on my local hard drive.
Edit :
1) I can't use the $Password way because I don't know who is logged (and password)
2) I already have a PSSession. My PSSession is with a service account But my remote script need my local credential I need 2 credentials
Invoke-Command -Session $RemoteServerSession -ScriptBlock $ScriptBlock -ArgumentList $LocalWorkstationSession
Because in my remote script I do want to do
$DriveOnWorkstation = New-PSDrive -Credential $LocalWorkstationSession -Name MyDrive -Root $UNCWorkstationFolderPath -PSProvider FileSystem