Created
July 21, 2025 06:26
-
-
Save rezamt/54657f42b0e0082a9dcc6f214d18f7e5 to your computer and use it in GitHub Desktop.
Revisions
-
rezamt created this gist
Jul 21, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ $username = "DOMAIN\ServiceAccount" $password = "YourPassword" $securePassword = ConvertTo-SecureString $password -AsPlainText -Force $credential = New-Object System.Management.Automation.PSCredential($username, $securePassword) # Now use the credential Start-Process powershell.exe -Credential $credential -ArgumentList "-File C:\path\to\script.ps1"