I'm trying to create a powershell script that start process with system user account. And I want to use a registered application in AAD as that system user account.

Here the code that I create. 

```
$ApplicationId = "My ApplicationID"
$ServicePrincipalSecret = "My Application's secret Key"
$SecurePassword = ConvertTo-SecureString –String $ServicePrincipalSecret –AsPlainText -Force
$Credential = New-Object System.Management.Automation.PsCredential ($ApplicationId, $SecurePassword)
Start-Process -FilePath notepad -Credential $Credential

```

this code dose not work. and return following error massage.

> 
> Start-Process : This command cannot be run due to the error: The user
>  name or password is incorrect. At line:1 char:1
>  + Start-Process -FilePath notepad -Credential $Credential
>  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  + CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
>  + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
> 
> 
> 

I tried following command to check my $Credential is correct, and successfully connected Azure. So my Credential object is created properly.

Connect-AzureRmAccount -Credential $Credential -Tenant "My Azure tenant ID" -ServicePrincipal

I also tried following code.

```
$psinfo = New-Object System.Diagnostics.ProcessStartInfo
$psinfo.FileName = "notepad"
$psinfo.UserName = $ApplicationId
$psinfo.Password = $SecurePassword
$psinfo.Verb = "runasuser"
$psinfo.UseShellExecute = 0
$psinfo.LoadUserProfile = 0
$ps = New-Object System.Diagnostics.Process
$ps.StartInfo = $psinfo
$ps.Start()

```

this code dose not work either. and return following error massage.

> 
> Exception calling "Start" with "0" argument(s): "The stub received bad
>  data" At line:1 char:1
>  + $ps.Start()
>  + ~~~~~~~~~~~
>  + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
>  + FullyQualifiedErrorId : Win32Exception
> 
> 
> 

Is there any good way to kick process with a user account that is qualified to manage Azure Active Directory different from a user who actually run the script? if anyone give me any advice will be appreciated.

thanks.