Install Software Remotely Using PowerShell

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I will guide you through the process of remotely installing software using Powershell you will learn how to accomplish this on both individual computers by deploying either MSI or exy packages and across multiple computers simultaneously hello I'm Zen and I'm thrilled to have you here on my YouTube channel if you are new to this space I would greatly appreciate your support by hitting that subscribe button your subscription keeps you updated with my content and motivates me to create more videos just for you thanks for being a part of this community several prerequisites must be met to deploy software on a remote computer using power shell successfully first ensure that you have administrative rights on the remote computer secondly Powershell remoting must be enabled on the remote computer Additionally you should allow Powershell remoting traffic through the firewall on the remote computer lastly make sure you have the necessary installation package ready while the installation package can be either an MSI or an XI package it's advisable to use MSI packages as they are better suited for automated installations for this demonstration I will be using two virtual machines the first is a Windows 11 workstation which will serve as the system from which I will deploy the software to the remote computer the remote computer in this case is a Windows 10 workstation assuming that you already have Administration rights on the remote computer the following requirement to meet is to enable Powershell remoting on the target computer to do so I click on the start menu and type Powershell then I click on run Powershell as administrator click yes on the Powershell console type the following command enable PS remoting Dash Force the force parameter will not prompt the user for confirmation hit enter you may notice that winrm Windows Remote Management is already configured on this computer because I have previously executed the powers shell command the command is now trying to start the winam service perfect Powershell remoting is now enabled on the remote computer the following requirement to fulfill is to allow Powershell traffic in the remote computer firewall to do so open the start menu and type firewall click on Windows Defender Firewall with Advanced Security on the firewall console right click on the inbound rule icon then click on new rule to create a new firewall rule on the new inbound rule wizard select predefined and click on the drop- down menu scroll down and click on Windows Remote Management click next you might notice that two predefined rules have been created labeled as Windows Remote Management HT TP in the first one pertains to the public profile while the second one is associated with the domain and private profiles I will uncheck the public profile since I want to restrict Powershell remoting functionality from being accessible on public and insecure networks like the internet I will only keep the second rule selected and I click next here I keep allow the connection selected and cck click the Finish button to create the rule to check the created rule I must refresh the inbound rules list then I will scroll down and seek for the rule here it is perfect on your local computer ensure that you download the installation package which can be either the MSI or ex package it's advisable to opt for the MSI package particularly for silent automated deployment one important point is that you should download the offline installer package not the online one the online installer may not contain all the required files for installation and would need to download them from the internet during installation this can be problematic in remote deployment scenarios so offline installers are strongly recommended in this demo I downloaded the Firefox MSI installer package which is is about 57 MB now let's examine our deployment script don't worry I will put in the video description the link to my blog article where you can access all the scripts discussed in this video in the initial lines we declare the variables necessary for this script we set the computer name variable to the remote computer's name which in this case is end user PC the destination folder variable is assigned the value of C temp lastly the file path variable stores the path to the MSI package on the local computer the first script instruction is to create a new Powershell session on the remote computer using the new PS session command next create the destination folder on the remote computer if it does not already exist next we copy the MSI package to the remote computer using copy item Powershell command then we install the MSI package on the remote computer using the invoke command that run this command line it's essential to note that this command will defer if you are running the exi package for exy package deployments you should use the following command start process - file path Etc the rest of the Powershell script remains unchanged okay back to the first script so once the installation is complete we remove the installation package from the remote computer finally we close the Powershell session using the remove PS session command ensuring our remote deployment process is clean now let's run the script and see the result it's now running I switch to the remote computer and wait till the Firefox shortcut appears on the desktop all right here is the Firefox shortcut the deployment was successful if you prefer using the remote computer's IP address instead of its host name especially if you find it easier to remember IP addresses you can do so but you need to make changes to the script for it to work correctly the first thing to change is to replace the computer name variable with the IP address variable I give it the IP address of the remote host the destination folder and file path variables remain the same next we need to add the remote computer IP address as a trusted host so that the local computer can open a Powershell session on the remote computer here is the command the script must execute next we open a Powers shell session on the remote computer copy the MSI installer package on the remote computer we execute the installer then we close the remote session now let's execute the script a popup shows up asking to provide the credentials to open a session on the remote computer we didn't get that promp when using the host name this is the difference between using the host name and the IP address I enter my credentials okay the script is running and is copying the MSI package to the destination folder on the remote computer after that the installer package will run and install the software on the remote computer the previous scripts we saw earlier are are made to deploy software on a single computer what if you need to deploy software on several computers the prerequisites remain the same enabling Powershell remoting and allowing Powershell traffic through the firewall ensuring that these prerequisites are manually fulfilled on multiple computers can be challenging thankfully there is a solution available group policy in this video I want delve into an in-depth explanation of how to implement these prerequisites through group policies however you can find a link to my blog article in the video description which provides a comprehensive guide with all the necessary details now let's examine the script the first lines remain unchanged except for the computer name variable which we will now assign the list of computer names in a text file next we enter a loop for each computer name in the computer names list we first open a Powershell session and we continue executing the same Powershell commands as we did earlier when deploying software on a single computer let's take a look at the text file containing the computer's list each line includes host name in this example I have only two hosts in the file you can access these powershare scripts in my blog articles you will find the link to the article in the video description I hope you find this video useful if so please consider giving it a thumbs up and subscribing to my channel for more engaging content in the future your support is greatly appreciated
Info
Channel: ZineTek
Views: 5,280
Rating: undefined out of 5
Keywords: Install Software Remotely Using PowerShell, installing software through power shell, powershell script to install software silently, remotely install software, powershell script, powershell script to install software, powershell script to install software to remote computers, installing software through powershell, how to use psexec to install software remotely, how to install software remotely using powershell
Id: -4OX6DETHNg
Channel Id: undefined
Length: 10min 55sec (655 seconds)
Published: Mon Nov 06 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.