Script_A.ps1 on Server A:
Invoke-Command -ComputerName Server B -ScriptBlock{
Set-Location "C:\Path"
.\Script_B.ps1
}
The Script "Script_B.ps1":
Set-Location "C:\Path"
.\Script_C.ps1 -Verb RunAs -Force
Script_C needs elevated permissions to execute. I can edit Script_A and Script_B but NOT Script_C.
My Problem is if I execute Script_A there is the error on Script_C:
Access Denied
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Script_C.ps1
+ PSComputerName : Server_B
Note: Script_C can execute, but it checks if it got started in the elevated mode and if it did not it gives me the access denied error. What am I missing that would it make work?