PowerShell - script execution on a remote computer with an error

This does not work for me -

%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -Noninteractive -command "& Invoke-Command -ComputerName "Spider_LT_86" -ScriptBlock { msiexec.exe /i "D:\3PDInstallers\ETLBackgroundWorkerSetup.msi" /qn /l*vx "D:\3PDInstallers\logs" }" 

all i need to do is run msiexec on the remote machine. I assume that the user running the script will get the necessary access to the remote computer.

the script does not work, even if the name Computername points to the local computer (and msiexec works with the same login, which works fine, so it does not look like a permission issue). I guaranteed that WinRM Service was running and I was also disabled for the firewall to check if this is the cause of the problem, but so far no luck. What am I missing here?

This is a complete mistake, but it lists all the features -

 Connecting to remote server failed with the following error message : WinRM cannot process the request. The following error occured while using Kerberos authentication: The network path was not found. Possible causes are: -The user name or password specified are invalid. -Kerberos is used when no authentication method and no user name are specified. -Kerberos accepts domain user names, but not local user names. -The Service Principal Name (SPN) for the remote computer name and port does not exist. -The client and remote computers are in different domains and there is no trust between the two domains. After checking for the above issues, try the following: -Check the Event Viewer for events related to authentication. -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport. Note that computers in the TrustedHosts list might not be authenticated. -For more information about WinRM configuration, run the following command: winrm help config. For more information, see the about_Remote_Troubleshooting He lp topic. + CategoryInfo : OpenError: (:) [], PSRemotingTransportException + FullyQualifiedErrorId : PSSessionStateBroken 

UPDATE:

When I use -Credentials only with a username, it opens a login window to get my password, and then when I enter it, it gives the following error: the user has access to the admin, so I don’t know what happened.

[spider_lt_86] Error connecting to the remote server with the following error message: access denied. For more information, see the help topic about_Remote_Troubleshooting. + CategoryInfo: OpenError: (:) [], PSRemotingTransportException + FullyQualifiedErrorId: PSSessionStateBroken

+5
source share
3 answers

This is more of a workaround than an answer, but since you can use wmi, why not try to create a remote process with it? Take a look here http://www.lazywinadmin.com/2011/06/powershell-launchstart-process-on.html?m=1

After exchanging comments, the problem is that you did not provide credentials with the administrative privilege for the remote host.

+2
source

Have you installed TrustedHosts on your computer so that you can connect to other computers?

Run this on the computer from which you are trying to uninstall.

 Set-Item wsman::localhost\client\TrustedHosts * Restart-Service WinRm 
+2
source

One thing is clear: the error message "Network path not found" does not indicate that the main problem. I saw a message in the Microsoft forum where the respondent stated that he was working, and now this has not happened. This is where I found myself. I confirmed that I could ping, and that I could view the shared shares, so I knew that the network ports were functional. I rebooted the source server and this did not seem to help. After I rebooted the target server , the WinRM error disappeared and everything started working again. It is unclear whether the service was omitted or something bad or something less obvious. After rebooting, I got another failure (out of about 20 attempts), but random failures in our environment are not so unusual.

I will leave it just in case it helps someone else.

0
source

All Articles