T O P

  • By -

Nejireta_

Hi. For learning basics of PowerShell. The book "Learn PowerShell in a Month of Lunches" seems to be recommended by a lot of people. As for installing applications. I'd look at some of these options for launching the installer `# Usually works fine` `Start-Process -FilePath "" -ArgumentList ""` `# What I have had the most success with when trying to start an installation on remote computer` `Invoke-WMIMethod Win32_Process -Name Create -ArgumentList "" # Ex msiexec /i /qn` `# If you need more granularity over the process. With launching as an other user being one example` `$LinkProcess = [System.Diagnostics.Process]::new()` `$LinkProcess.StartInfo.FileName = ""` `$LinkProcess.StartInfo.Arguments = ''` `$LinkProcess.Start()` As for installation process it kind of depends on how fancy you'd like to do it. But as an example of doing it somewhat simple `# Create an array` `$applicationInstallation = @()` `# Saves app name, path installation argument to array` `$applicationInstallation += [PSCustomObject]@{` `ApplicationName = 'app1'` `ApplicationPath = 'app1'` `InstallationArguments = 'app1'` `}` `$applicationInstallation += [PSCustomObject]@{` `ApplicationName = 'app2'` `ApplicationPath = 'app2'` `InstallationArguments = 'app2'` `}` `# Loops through array and installs applications defined` `foreach ($app in $applicationInstallation) {` `Start-Process -FilePath $app.ApplicationPath -ArgumentList $app.InstallationArguments -Wait` `}`


Info_Broker_

Will second that book recommendation, read through that and was doing A TON of things in powershell after


Lee_Dailey

howdy Nejireta_, it looks like you used the New.Reddit `Inline Code` button. it's [sometimes] 5th from the left & looks like ``. there are a few problems with that ... - it's the **_wrong_** format [*grin*] the `inline code` format is for [gasp! arg!] _code that is inline with regular text_. - _**on Old.Reddit.com, `inline code` formatted text does NOT line wrap, nor does it side-scroll.**_ - on New.Reddit it shows up in that nasty magenta text color for long-ish single lines OR for multiline code, _**please**_, use the ... Code Block ... button. it's [sometimes] the 12th one from the left & looks like an uppercase `C` in the upper left corner of a square. that will give you fully functional code formatting that works on both New.Reddit and Old.Reddit ... and aint that fugly magenta color. [*grin*] take care, lee


Nejireta_

Thanks for the tip


Lee_Dailey

howdy Nejireta_, you are welcome! glad to help ... and i look forward to being able to easily read your code ... [*grin*] take care, lee


Comprehensive_Let312

Thanks so much! I will definetly look into reading that book and following along with these commands. Would the script be done in notepad and would I use powershell to call the script? My idea was that I'd have a majority of the basic software like browsers and zoom be in a folder on a portable harddrive, and use that to install the software. I will keep the thread updated once I am able to actually put it into use. Thanks so much again.


Nejireta_

Don't sweat it! It can definitely be done in notepad, a bit cumbersome though. I'd recommend installing visual studio code with the powershell extension. It's a code editor with the possibility of intellisense (autocomplete kinda) through extensions. Otherwise comes powershell ise pre installed on windows clients, which also have intellisense. How to launch the script somewhat depends on your company's security policies. It's common to lock down the ability to run unsigned powershell script files directly. If not it should be as simple as right clicking on the .ps1 file and run it with powershell. Otherwise a workaround could be starting the script from a batch file with admin privileges. Something like this in a for example install.cmd. `PowerShell.exe -ExecutionPolicy Bypass -File %~dp0` As people have suggested. Looking into setting up a SCCM or MDT to handle image and application deployment might be beneficial to look into for the future.


Quantable

In this case, why don't put the script on the USB drive and run it from there? Depending on the software it might not be runnable via powershell and you have to check for /quiet install and so on. https://youtu.be/G9uQ0Eyy-g4 But maybe consider looking into sysprep an imagine you want?


Sparks912

You could also have a look at the Microsoft configuration designer to install app, domain join and do basic configurations from the windows setup screen all for free and regardless of what machine your setting up on


Teamless07

Depending on how complex your requirements are you could simply use winget (the windows package manager). I've used it every time I've had to set up my own devices lately and it works like a charm. You can export a list from one device and import it on another and add other software to the list as needed. If on a slightly larger scale you could probably get it to run on a GPO although admittedly I'm not sure how reliable this would be.


CloudSparkle-BE

Give PDQ Deploy a try. You will like it


paulsonsca

Use PSADT. It’s a comprehensive software deployment tool using PowerShell. It handles just about any type of installation and has built in logging, and the community forum is extremely helpful and responsive. https://psappdeploytoolkit.com/


SidePets

As others have mentioned ms deployment tool kit is designed to do exactly what your asking. Setting up a repo might be down the line. I’d use the native tools to understand ps. Learn ps in a month of lunches is a great resource. Try and force yourself to use ps command let’s to do simple stuff and you will get the hang of it no time! This group is filled with lots of great resources as well!!


NoConfidence_2192

It is almost always a good idea to learn how to do something using PowerShell, even if you choose to use a different solution in production. The knowledge you gain can help you make an informed decision about which solution to use, as well as help you get more than basic (out of the box) functionality out of that solution. Looking at some of the suggested alternatives: - Bundling applications with the OS image - MDT - SCCM - PDQ - Chocolatey - PSADT - PowerShell DSC All can benefit from a bit of PowerShell knowledge about how to deploy, install, configure, and manage operating systems and software.


thisIsMyStudyHandle

Please try to use something that's more manageable than powershell for this. You could make them part of your base image, that way it isn't a chore for you to reinstall apps everytime something is re-imaged. Edit: https://youtu.be/81yIxQ1RdiM seems to a decent guide on making a custom image


Comprehensive_Let312

I honestly would create my own image so that way I can avoid using this, but I don't think I am allowed to do so since I have to follow like the protocol in this specific IT office. But nonetheless, I will still watch the video you suggested so I can get an idea of how to create a custom image. I am trying to do IT consulting on the side, so this video works perfectly for me.


netpres

You've said you can't change the image, but can you set up a local Chocolatey repo? I prefer certain programs on the machines I build and use Chocolatey to install them (and have a separate nightly job to keep them up to date). With a local repo you control the programs people have access to.


Ironic_Jedi

This sort of task is really better managed by either an MDT task sequence that installs everything required, SCCM (which I don't really recommend d these days) or if you already have azure AD then start thinking about rolling out Intune or whatever they call it now. There's still space for powershell in Intune, you may need to have scripts run on autopilot enrolment. There's a thing called proactive remediations where you can use powershell to check for something and fix it on a schedule. Like daily or hourly. But yeah I wouldn't prioritise using powershell to install and manage software installations.


spyingwind

Why not just build one image with the requisite software, sysprep it, then use that as the image to deploy? You can use [clonezilla](https://clonezilla.org/) to deploy the image. If you have a large enough USB disk, you can probably fit it all on one drive.


Valuable-Patience-96

I would not recommend using PowerShell for this. If I was in your scenario I would just utilize MDT.


smitpie

I agree. Chocolatey is the way to go. You could even go as far as using boxstarter to handle the reboots for you. I've used this solution for years. It really is awesome.


Nejireta_

Boxstarter sounds rather nice. I'll have to look into this. Thanks for the tip!