PowerShell post installation (from web address)

Dav1

Member
Hello friends

I would like to install my software via powershell by writing on the script that it will download and install with an http:// address that it will execute during the installation of Windows. Can you tell me if this is possible? where could I turn because I don't know much about it I would like to carry out this project

if anyone can guide me in this realization, where I could start thank you
 
Last edited:
Chocolatey's install script performs this exact mission, by executing a script downloaded from a website.
Code:
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Replace the DownloadString, and check if you need the second part which updates the shell's path.
 
hello garlin

thanks for your return

I put the script but it does not launch when installing Windows

I put this in NTLITE post installation machine on powershell then save

powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/ install.ps1'))"

what parameter could I put

THANKS
 
CommandParameters
powershell-NoProfile -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://mywebsite.com/my_script.ps1'))"


Update:

I'm thinking your request isn't very clear. Do you want to download EXE and MSI files from an URL list, and then install them?
Or want to run a script downloaded from a server?

If you want the first option, then use Chocolatey package manager. They have a good collection of supported apps.

If you want to run a script which you can use a remote server to keep the script updated (instead of changing the ISO every time), then use the current PS command.
 
Last edited:
yes garlin this is exactly what I want to download EXE and MSI files from a list of URLs, then install them and include them in windows at the time of installation

THANKS
 
The problem isn't scripting downloads from a list, that part is easy. How do you match the silent install options for each file?

EXE files don't have to follow the same rules. MSI will usually do /qn, but some installers want you to provide a language code, or more info. So why not use Chocolatey, which knows both the download URL's and the silent flags?

Install Chocolatey via PowerShell & Post-Setup software
 
I captured the chocolatey script that you put on the page I can download and install different software but how can I include it in my ISO image

I can't find certain software like ntlite on chocolatey

thanks to you
 
You're not searching very hard.
https://community.chocolatey.org/packages?q=ntlite

NTLite (Free) (Install) 2.3.6.8804

Many apps will use the same download URL and silent install options, so nothing really changes except the checksum for the original file version. Chocolatey tries to protect you whenever the checksum doesn't match, and skip the install. When nobody has updated the Chocolatey package in a while, you can use the ignore-checksum option to force an install.
Code:
choco install ntlite-free --ignore-checksums -y

Update: Corrected missing space character.

This is better executed using a single .bat file, so you don't have to worry about updating the PATH.
Code:
@echo off
powershell -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))"
set PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

choco install ntlite-free --ignore-checksums -y
choco install firefox -y
 
Last edited:
Je suis nouveau dans ce domaine et je regrette de ne pas avoir plus d’expérience.

J’ai regardé sur le forum ntlite je n’ai pas trouvé grand chose à ce sujet, j’ai essayé plusieurs fois et le script ne démarre pas dans l’ISO, je ne sais pas quoi mettre en paramètre

J’ai mis différentes captures pour le guide merci garlin

script powershell.jpgLogiciel bat.jpgCapture d'écran 2023-10-27 144325.jpg
 
You only need one of them. Use the batch file. If you like to watch the install progress, run the batch file from Post-Setup (User).
 
I put a single file in .bat but I don't know what command to put so that it executes the installation of chocolatey thank you


Capture d'écran 2023-10-27 214853.jpg
 
1st line downloads and installs Chocolatey.
2nd line updates the PATH, inside the script so it finds "choco"

You add "choco install [app]" lines after that to install new software. There are no outside parameters because the script doesn't need one.
 
thank you garlin even if I still have trouble understanding everything

and if I want to put it in powershell is it the same manipulation?
 
J’ai essayé de nombreuses manipulations mais le script ne se lance pas.

J’ai mis les captures, pouvez-vous me dire où ce n’est pas bon s’il vous plaît.

J’ai essayé de suivre ce que vous m’avez demandé mais ce n’est pas facile car je n’ai jamais fait ce genre de manipulation.

Sur le paramètre j’ai mis le chemin du script mais il ne s’exécute pas, j’ai vérifié sans assistance <setupcompleteOEM>

J’ai mis à jour le chemin sur le script comme demandé

MERCI

Capture d’écran 2023-10-28 021828.jpgCapture d'écran 2023-10-28 023423.jpg
 
Last edited:
Why are you making changes which are not needed? Take my batch file, and add it to Post-Setup (User). NOTHING MORE.

The only thing to change is the list of apps inside the script. Chocolatey's install script is downloaded and executed in memory, and it copies all of Chocolatey's files to their final destination. There is no need to worry about $OEM$ or %WINDIR% folders.
 
After checking post #8, there was a missing space after New-Object (which disappeared because the long line was wrapped).
The correction has been added. Sorry for the editing problem.

Capture.PNG
 
I made the modification on the bat file I tried again by installing windows it does not work, I put as in your capture that you posted but the file does not execute

on the other hand with powershell I managed to install chocolatey but it does not install the software requested

powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/ install.ps1'))"


parameter: -NoProfile -ExecutionPolicy Bypass

Choco Install NTLITE free
Choco install skype
choco install googlechrome

thanks garlin
 
Last edited:
Back
Top