Hello Techies,
I'm just a noob in PS lengthy commands and scripting - still in a learning stage.
I'm struggling to find the command to execute mpam.exe on a remote server.
I have a file in C:\temp\mpam.exe in Server1. So wanted to execute this file in Server2 without copying the file to Server2.
Below are the attempts I tried but had no luck:
Invoke-Command -ComputerName Server2 -ScriptBlock {\Server1\c$\Temp\mpam.exe}
\Server1\c$\Temp\mpam.exe : The term
- CategoryInfo : NotSpecified: (\Server1....exe : The term :String) [], RemoteException
- FullyQualifiedErrorId : NativeCommandError
- PSComputerName : Server2
Invoke-Command -ComputerName Server2 -ScriptBlock {powershell.exe \Server1\c$\Temp\mpam.exe}
\Server1\c$\Temp\mpam.exe : The term
- CategoryInfo : NotSpecified: (\Server1....exe : The term :String) [], RemoteException
- FullyQualifiedErrorId : NativeCommandError
- PSComputerName : Server2
Invoke-Command -ComputerName Server2 -ScriptBlock {powershell.exe \Server1\c$\Temp\mpam.exe -ArgumentList '/slient' -Wait}
\Server1\c$\Temp\mpam.exe : The term
- CategoryInfo : NotSpecified: (\Server1....exe : The term :String) [], RemoteException
- FullyQualifiedErrorId : NativeCommandError
- PSComputerName : Server2
This one came up with no errors, however, mpam hasn't been installed on Server2
Invoke-Command -ComputerName Server2 -ScriptBlock {cmd.exe \Server1\c$\Temp\mpam.exe -ArgumentList '/slient' -Wait}
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
I've also tried using Enter-PSSession and it
[Server2]: PS C:\Users\user1\Documents> \Server1\c$\Temp\mpam.exe
The term '\Server1\c$\Temp\mpam.exe' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
- CategoryInfo : ObjectNotFound: (\Server1....\mpam.exe:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException
Any help would be highly appriciated.
Thanks in advance.
Cheers,
Sri