Command/More/Credentials.ps1
# Write a "WebCredential" [Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime] $Vault = New-Object Windows.Security.Credentials.PasswordVault $Vault.RetrieveAll() $Cred = new-object -Type Windows.Security.Credentials.PasswordCredential -ArgumentList 'Powershell','Holger','Passw0rd' $Vault.Add($Cred) # This script requires the install of CredentialManager from the online gallery # Install-Module -Name CredentialManager #Import-Module CredentialManager -Force #New-StoredCredential -Target "MyTarget" ` # -UserName "aaa" -Password "bbb" -Comment "My own comment" -Persist Enterprise -Type Generic #$Cred = Get-StoredCredential -Target "MyTarget2" #if($null -eq $Cred) #{ # Write-Output "not found" #} #Write-Output $Cred #Read-Host "wait..." #$Username = "AD001\z0012stm" # #$Password = '2w+p2w+p2w+p' #$Username = "z0048bpr" # #$Password = "#Gx{Hn3LPjUE3sa1c" # $PW = '#Gx{Hn3LPjUE3sa1c' #$ChromePath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" #$cred = Get-Credential -UserName $Username -Message ' ' #Start-Process Powershell.exe -Credential $cred ` # -ArgumentList '-noprofile -command &{Start-Process Powershell -verb runas}' #Start-Process chrome #runas /user:z0048bpr /savecred "powershell -c start-process -FilePath \"'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'\" -verb runAs" |