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.

Wednesday, August 26, 2015

Multiple ways to Install Software remotely on Windows - Method 4 WMI (Windows Management Instrumentation)

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 

WMI - Windows Management Instrumentation is a  Windows API, With WMI you can fetch tons and tons of Windows information remotely also you can configure windows remotely, I use it to configure and fetch information remotely with great success. Software such as SCCM is heavily dependent on WMI for inventory, Also with the help of WMI in Group policy you can push policies to certain set computers. Its very handy tool for Windows System Admins.

Before starting operation I have kept all my softwares on shared drive \\AD001\Softwares and it has all the necessary folder permissions assigned (check my another blog Method 1 for the same.). I will be demonstrating Adobe Acrobat reader installation here.

I download Acrobat reader it comes in exe format, For unattended installation you can use below parameters
UNC Path\\Adobeacrobatreader.exe /sPB /rs

More parameters information.

/sAll Silent Mode for product
/sPB Silent Mode with Progress Bar for product
/rs Reboot Suppress
/ps Reboot Prompt Suppress
/ini "PATH" Alternative initialization file
/sl "LANG_ID" Set Language; LANG_ID - Code in decimal digits
/l Enable Error Logging. Log file Bootstrap.log will be generated in temp directory
/msi[Command line] Parameters for MSIEXEC


But instead installing i will go with MSI installer, So I can show you how To extract msi from adobe acrobat reader exe setup. use below command. (no space between -nos_o")

AdbeRdr1010_en_US.exe.exe -nos_o"C:\softwares\Adobe" -nos_ne
Once files are extracted on shared drive you will need to add trusted delegate computer account on Remote computer account in Active Directory,  Here I am going to execute programs kept on UNC path from AD002. and my remote server is client001.
Means I will be adding AD002 as a trusted delegate on client001 in AD. Why i am doing this. This steps resolve my UNC path connection issue over WMI, I will be able to successfully authenticate to Share Drive, 

Next add CIFS service from the list click apply or ok.
Without above AD step WMI will get access denied for UNC path.
Next step i final action executing WMIC command
wmic /Node:Client001 process call create "msiexec.exe /i \\AD001\Softwares\AdobeAcrobatReader\AcroRead.msi ALLUSERS=1 /qn /norestart"
Above Green marked Node is the computername and the UNC share path where I have kept my applications. 
As you can see Method execution is successful, Process ID generated on remote computer and Returnvalue is 0 means there is no error. To verify out msiexec process is executed successfully check installed programs appwiz.cpl. Application must be installed after some time.
Next method i will be covering is Powershell way to install softwares remotely.
Multiple ways to Install Software remotely on Windows - Method 5 PowerShell Remoting

Sunday, August 23, 2015

Multiple ways to Install Software remotely on Windows - Method 3 Command line microsoft psexec tool

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 

Last 2 methods I shown where GUI and easy ones. In this section I will be showing how to 
use Command line Microsoft sysinternal tool called PSEXEC (It is part of PSTOOLS). This is One of the best tool for doing windows operations remotely. This has saved my day many times.

I will be showing VMware tools installation remotely. (They are necessary to install on newly deployed Virtual Machines on VMware ESXi), they contains multiple file, you can obtain them from right clicking VM, inside the VM ISO file will be mounted, copy all the CD contains to share folder, and provide appropriate priviledges.


PSEXEC is a command line tool single exe file, and need to download from microsoft website https://technet.microsoft.com/en-in/sysinternals/bb897553.aspx.

Once you download unzip it and extract PSEXEC.exe to c:\windows folder. 

Next create 2 files on the local drive from where you will be executing psexec, I have created under c:\temp, one is computerslist.txt file and second is installationscript.bat. Computerlist.txt contains all the computers list. (here I want to show you installation of application on multiple PC instead of single one). And the second batch has script to map software share drive and run setup.exe file on the mapped drive. If you use batch file you wont get Access denied or any other busy error.

Batch file commands are
net use s: \\192.168.33.11\Softwares\VmwareTools /user:vcloud\vkunal Computer@1
* Username and password is mandatory.

S:\setup.exe /S /v /qn REBOOT=R
*Running setup.exe from mapped drive, Automated installation Parameters found from VMware tools documents
Open Command prompt (cmd). And run below command.

psexec.exe @c:\temp\computerslist.txt -c c:\temp\installationscript.bat

For command line summary I am running psexec.exe kept under c:\windows, it is taking computer names serially from @c:\temp\Computerslist.txt and next psexec will copy installationscript.bat file will be copied on computer's list and executed.

(I am getting error code 3010 means Plan for reboot to take vmware tools installation, If you are getting error 1603 means there is some fatal error while installation, try rebooting remote servers might fixt your issue)
PSEXEC tool is highly dependent on Admin$ share. I Admin$ share is disabled it doesn't work. 
Next method I would be showing is WMI Windows Management Instrumentation using process class. Multiple ways to Install Software remotely on Windows - Method 4 WMI (Windows Management Instrumentation)

Saturday, August 22, 2015

Multiple ways to Install software remotely

I will be covering some cool methods to install softwares remotely, In each blog I will be using different approach to perform the tasks. Within all the blogs there is common requirement to keep software on shared location (add some accounts the share and security tabs) and the second requirement is application should be capable of unattended installation. You can achieve it by using parameters. If anyone find or know any other solution to install software remotely and it should be included in this series I would be happy to cover it here as method 9.

Both the steps sharing folder and testing unattended installation of application has been covered in very first Method 1 Group policy.  Stay tuned for more blogs.
 


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 

I just want you to remind you about method 0 Remote Desktop connection (MSTSC) for remote deployment, but will not show step by step as I am sure everyone must have use this at least once.


 

Multiple ways to Install Software remotely on Windows - Method 2 Third party softwares

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 

Second method I will be covering up some third party software to push software remotely, unlike Group policy you get freedom to install them at specific schedule or on the fly on the specific list and the main benefit would be you can have inventory and you know where software deployment is succeed or failed. And one more benefit i see is of deploying software through third party software is you can use MSI installers as well as EXE installers also. (EXE can be deployed through GPO using ZAP files but they will be published instead of assigned)

There are many software available to do this task, examples are (Microsoft solution) SCCM, ControlUp, PDQ Deploy, Bozteck VENM and list goes on. Here I will be using PDQ Deploy free mode to show complete demo of application installation remotely.

I Registered on PDQ Deploy website, and then downloaded and Installed PDQ Deploy on my one of server, Installation is very easy few clicks., Not much interactive.
Once application is launched you have 2 main tasks Create software package and second is create a list or machines you want to install softwares (It can have list from Active directory as well), When you launch application for first time it will ask for licenses, you can use Free mode for testing, and will ask for Administrator Username password (This is my domain admin account and has admin rights on all the servers)
 
You can setup different domain and username password under File>preferences>Credentials
Once you all set next task is to create software package.
Give some name for the package, Deploy user is my vcloud\vkunal admin credentials will be used for deployment, they were configured while initial configuration, next is Step 1, Keep software file on central shared location and save the package (This step is covered in my first blog Multiple ways to Install Software remotely on Windows - Method 1 Group Policy, Also you will have to check executing MSI file with msiexec tool whether it is installing unattended, this step is also covered in Method 1 Group Policy application deployment)
Once you save it package will be listed under packages. Next step is create a list of computers to install applications.  Computers can be added by fqdn or ip, you have also option to select targets, Computer names can be imported from Active directory, inventory softwares or txt file. I have selected here simple one adding computer for demo purpose, and there will be 2 computers in my list. (Client001 and 192.168.33.15)
Once you are done these 2 steps, you are ready to install softwares remotely, go to packages and 7zip package, click Deploy and deploy once from the drop down menu, other scheduling options are grayed out because we are using free version.
Once the computers are added press Deploy and magic begins it will start pushing softwares. You can see the deployment status on the main screen of packages
This is very good GUI method. You can check remote computer for installed applications. (While using this tool I found there is very necessary requirement, Default share Admin$ must be enabled, Without this software installation will fail.)
Next method I will be using some command line tools to install software. Have you used PSEXEC tool check it
Multiple ways to Install Software remotely on Windows - Method 3 Command line PSEXEC tool

Tuesday, August 18, 2015

Multiple ways to Install Software remotely on Windows - Method 1 Group Policy

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 
 
There are multiple way you can install software remotely, One of the method is Group Policy its very easy if you want to manage deployment of softwares on multiple systems. But the requirement is all the systems needs to join to the AD domain.

It doesn't require any extra setup if system is in domain, you have to just create a group policy and Software package, once done link it to appropriate Computer OU or your entire domain (Here I will be creating software package in computer node) and you are done.

Below is the step by step method for the same.

First thing first, Keep your application on shared location, This shared file should have Authenticated users (Read permissions) added to Share and Security tab.

Here I have created folder C:\Softwares on my AD (Hostname AD001), and these are the permissions given. these are permissions on sharing tab, now my shared location is \\AD001\Softwares. Under this location I am going to keep my softwares. This step is essential
Next is security permissions here add Authenticated users. Now you are all set as first phase, from this centralized location Group policy will push application on machines.
Next phase I will be coping software files (MSI) on this share and test it installing by command line to check whether it is getting installed unattended and no human intervention is required while installation.
Open command prompt with as an administrator, and run below command to check you have correct MSI file. (Change shared file location as per your need)

msiexec.exe /i "\\AD001\Software\NotepadPlusPlus\NotepadPlusPlus679.msi" ALLUSERS=1 /qn /norestart /log c:\temp\output.log
Open Group Policy management go to Group Policy Object, Right Click and create new Policy. My policy name is Software_NotepadPlusPlus, Right click and edit it.
Under Computer Configuration > Policies > Software Settings > Software installation > right click and create new package
It will pop up new windows and ask for the MSI file location, provide here shared application path \\AD001\Software\NotepadPlusPlus.msi
 Keep it assigned click ok.
Once the package is configured. You are done, close this policy and link it to corresponding computer OU.
Link Software policy  and restart your computers.
It will required reboot see changes on computers, Notepad++ will be installed on computers on next reboot. What I found is when deploying (assigning ) application through Group Policy it can slow down log-in process as it is waiting to application get installed. and also inventory is hectic if you want to rectify if any server missed in this process. Just think what will happen if you you are deploying (assigned) Microsoft office.
To cross verify open command prompt as administrator, type and run GPRESULT /R /scope computer to see software policy is applied. Its very easy and automated.
In my next blog I will be using some third party software to install softwares remotely. 
Multiple ways to Install Software remotely on Windows - Method 2 Third party softwares (PDQ Deploy)

Wednesday, August 12, 2015

Copy files on all computers using group policy

Group policy is very handy when you want to do some repetitive boring tasks on multiple machines, it saves time, and it is always error free. Example of files can be copied through GPO on computer is Dll file or can be portable EXE files for users (ie putty.exe).

One of my subordinates got an activity to copy putty.exe on all the windows servers arount 1200. Isn't it boring. So I proposed him automated solution and this how I achieved the task in couple of minutes. I copied Putty.exe to share folder and Read permissions given to Authenticated user under sharing and security. My shared network path name is \\AD002\files.
 Above screenshot is for sharing and below is for security, Autheticated users has Read permissions.
Copy putty.exe on share path.
Open group policy management tool on domain controller or your PC if you have installed administrative tools.go to Group Policy objects, right click and new GPO. Give it some name (Copy_Putty)

Right click and Edit Copy_Putty policy.
Now go to Computer Configuration>> Preferences>>Windows Settings>>Files>> New>>File.
Source is the my shared file location here I have copied my Putty.exe and from here it will be copied to destination c:\windows on all servers.
This is how policy looks, Close it
Its  time to attach policy to OU where my computers reside. Go to that OU right click and link an Existing GPO.
 Select Group Policy Copy_Putty from list.

Its all done now you have wait either for next 90 mins or run GPupdate /force on computers you will see Putty.exe file present under C:\windows folder.

Now user can use find program putty for ssh into linux.
Read my another Post
How to - Adding AD Group to local computer Group using Group Policy