Hi,
I'm trying to get a poweshell script to run as my privileged account in an enterprise domain below is the power shell script that I'm running. This is just a test script where I'm trying to get-process at the mometn.
Start-Transcript C:\Users\useraccount\Desktop\PSLog.txt $computer = Read-host "please enter a fully qualified computer name" Test-WsMan $computer Invoke-Command -ComputerName $computer -ScriptBlock { Get-Process Powershell > C:\Users\useraccount\Desktop\Process.tx } -credential [-username] exit Read-Host -Prompt "Press Enter to exit" Stop-Transcript
I'm using the below batch command to run the script.
@ECHO OFF PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%~dpn0.ps1""' -Verb RunAs}" PAUSE
And below is the Transcript:
**********************
Windows PowerShell Transcript Start
Start time: 20150525160839
Username : domain\PriviledgedAccount
Machine : HostName (Microsoft Windows NT 6.1.7601 Service Pack 1)
**********************
Transcript started, output file is C:\Users\Useraccount\Desktop\PSLog.txt
please enter a fully qualified computer name: HostName
wsmid : http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.x
sd
ProtocolVersion : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor : Microsoft Corporation
ProductVersion : OS: 0.0.0 SP: 0.0 Stack: 2.0
[HostName] Connecting to remote server failed with the following error messa
ge : Logon failure: unknown user name or bad password. For more information, se
e the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (:) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionStateBroken
**********************
Windows PowerShell Transcript End
End time: 20150525160902
**********************
Not sure why this is not authenticating, I'm running the batch file as my PriviledgedAccount by holding Shift, Run as a different user.
I will need this to jump across domains eventually but just want to get this to work in one domain at the moment.
Any advice or hints in regards to why I'm getting the authentication error would be greatly appreciated.