Saturday, August 29, 2015

Multiple ways to Install Software remotely on Windows - Method 5 Powershell Remoting

Multiple ways to Install software remotely
Multiple ways to Install Software remotely on Windows - Method 1 Group Policy
Multiple ways to Install Software remotely on Windows - Method 2 Third party softwares

Multiple ways to Install Software remotely on Windows - Method 3 Command line PSEXEC tool
Multiple ways to Install Software remotely on Windows - Method 4 WMI (Windows Management Instrumentation)
Multiple ways to Install Software remotely on Windows - Method 5 PowerShell Remoting
Multiple ways to Install Software remotely on Windows - Method 6 PowerShell DSC (Desired State Configuration)
Multiple ways to Install Software remotely on Windows - Method 7 Copy Portable applications 
Multiple ways to Install Software remotely on Windows - Method 8 Task scheduler 

In this article I will be covering remote installation using powershell. Powershell is windows scripting tool and may replace cmd (Command prompt) gradually over the time. Powershell has remoting feature as same as ssh in linux. Powershell uses WS-Manangement protocol to connect remotely, and it need to be enabled on remote server (as same as remote desktop).

Requirement is both the server and client should have powershell installed. below steps done to enable psremoting.

Start PowerShell as administrator and fire below command.

Enable-PSRemoting 

Basically it does below main things  
Start WinRM service (Windows Remote Management (WS-Management)), set to auto automatic start. Add any hosts * in the listeners (clients) list (any computers in the same domain can connect over WINRM protocol), and the last thing is to enable firewall exception for WS-management traffic. 

Type couple of Y to agree all the required changes. This need to be setup on remote server. And you are ready to connect.

In this section I will be using SCCM client to install remotely, as usual it is located on shared drive, From any other server open powershell, Go with the below command. Line in the bold is invoke-command (to execute command remotely) and you will need to replace hostname according to your need (provide netbios name only, To work IP address correctly you will need to add ips to trusted host list.),  In the curly brackets I have executed SCCM client kept on shared drive, ccmsetup.exe with its parameters pointing toward site code and other info.

Invoke-Command -ComputerName Client001 -Command {\\ad001\Softwares\SCCMClient\CCMSetup.exe /mp:SMSMP01 /logon SMSSITECODE=S01 FSP=SMSFSP01}

Here you are done and you can check on the remote server for Installed application. 
There are more methods I will be addressing in my next articles.

Next is Powershell DSC Desire state configuration to install software remotely in line.
Method 6 PowerShell DSC (Desired State Configuration) install software remotely.
Post a Comment