I have a script on my local machine and want to run it on a remote server:
I run this command in PowerShell ISE:
Invoke-Command -ComputerName it-xyztest -filepath C:\Scripts\XYZScript.ps1
When I run this I get the error message:
[it-xyztest] Connecting to remote server it-xyztest failed with the following error
message : Access is denied. For more information, see the about_Remote_Troubleshooting
+ CategoryInfo : OpenError: (:) , PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionStateBroken
I know nothing about the remote machine.
When I try Enter-PSSession -ComputerName it-xyztest
To test connectivity I get this:
Enter-PSSession : Connecting to remote server it-mgmt01 failed with the following error
message : The client cannot connect to the destination specified in the request. Verify
that the service on the destination is running and is accepting requests. Consult the logs
and documentation for the WS-Management service running on the destination, most commonly
IIS or WinRM. If the destination is the WinRM service, run the following command on the
destination to analyze and configure the WinRM service: "winrm quickconfig". For more
information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName it-xyztest
This is what is in my script:
$args = '/i "\\xyz.com\gpo$\TESTInventory\TEST Inventory.msi" /quiet /norestart'
All I want to do is run this .ps1 from my desktop to a remote server.
What do I have to do? Help I'm stuck.