P.J Douillard
P.J Douillard

Reputation: 11

winpe 4.0 using Start-Process with -Credential doesn't work as it should

Once my deployment script starts, I'm trying to run this under WinPE 4.0:

Start-Process x:\windows\notepad.exe -Credential (Get-Credential)

I provide the proper credential to the Credential popup window, but then I received this error:

cmdlet Get-Credential at command pipeline position 1 Supply values for the following parameters: Credential start-process : This command cannot be run due to the error: The specified service does not exist as an installed service. At line:1 char:1 + start-process x:\windows\system32\notepad.exe -Credential (Get-Credential) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException + FullyQualifiedErrorId : InvalidOperationException, Microsoft.PowerShell.Commands.StartProcessCommand

If I remove the -Credential switch, notepad.exe is executed properly just to let you know.

Running the same exact line (with -Credential) on Windows Server 2012 works perfectly, so I am thinking that PowerShell 3.0 or either .NET 4.0 under WinPE 4.0 is missing something.

Thank you for any help or pointers.

Upvotes: 1

Views: 1286

Answers (3)

Darrick West
Darrick West

Reputation: 1

Pass an empty string argument to the -Credential parameter: start-process x:\windows\system32\notepad.exe -Credential ""

This will display the credential dialog, but there will be nothing to authenticate to because the necessary service isn't installed in WinPE.

Darrick West

Upvotes: 0

user189198
user189198

Reputation:

You cannot start a process under alternate credentials, because WinPE does not have (or at least expose) a Security Account Manager (SAM). Since WinPE cannot be joined to an Active Directory domain, you cannot launch a process under domain credentials. Furthermore, because WinPE does not have (or perhaps simply does not expose) a Security Account Manager (SAM), you cannot create custom user accounts under WinPE.

Upvotes: 0

Keith Hill
Keith Hill

Reputation: 201592

Try passing in a programmatically created credential e.g.:

$passwd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
$cred = new-object System.Management.Automation.PSCredential "username",$passwd
Start-Process x:\windows\notepad.exe -credential $cred

Upvotes: 0

Related Questions