Skip to content
Snippets Groups Projects
Commit 78780497 authored by Andreas Lindemark's avatar Andreas Lindemark
Browse files

Added empty lines after PowerShell code.

Changed download URL's for manual download.
parent 3f06de6d
No related branches found
No related tags found
No related merge requests found
......@@ -95,6 +95,7 @@ The script requires a `config.json` file to provide necessary configuration deta
1. Copy the `config.template.json` file to a new file named `config.json`.
```sh
cp config.template.json config.json
```
2. Open config.json and replace the placeholders with your actual values.
......@@ -112,6 +113,7 @@ This one-liner download and install does the following:
1. First download the config.template.json (saved as config.json)
```powershell
$tempPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath('Desktop')); $configFile = "$tempPath\config.json"; Invoke-WebRequest -Uri "https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/Chocolatey/config.template.json" -OutFile $configFile;
```
2. Modify config.json with your own settings.
......@@ -119,33 +121,35 @@ This one-liner download and install does the following:
3. To run the script, you need to temporarily change the PowerShell execution policy to allow script execution. You can do this by using the following one-liner code:
```powershell
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; $tempPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath('Desktop')); $script1 = "$tempPath\ChocolateyUpgrade.ps1"; $script2 = "$tempPath\InstallConfigureChocolatey.ps1"; $script3 = "$tempPath\ScheduleChocolateyUpgrade.ps1"; $configFile = "$tempPath\config.json"; Invoke-WebRequest -Uri "https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/Chocolatey/ChocolateyUpgrade.ps1" -OutFile $script1; Invoke-WebRequest -Uri "https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/Chocolatey/InstallConfigureChocolatey.ps1" -OutFile $script2; Invoke-WebRequest -Uri "https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/Chocolatey/ScheduleChocolateyUpgrade.ps1" -OutFile $script3; & $script2; & $script3; Remove-Item -Path $script1, $script2, $script3 -Force; Write-Output "Check the log file at C:\Install Logs\*.log"
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; $tempPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath('Desktop')); $script1 = "$tempPath\ChocolateyUpgrade.ps1"; $script2 = "$tempPath\InstallConfigureChocolatey.ps1"; $script3 = "$tempPath\ScheduleChocolateyUpgrade.ps1"; $configFile = "$tempPath\config.json"; Invoke-WebRequest -Uri "https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/Chocolatey/ChocolateyUpgrade.ps1" -OutFile $script1; Invoke-WebRequest -Uri "https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/Chocolatey/InstallConfigureChocolatey.ps1" -OutFile $script2; Invoke-WebRequest -Uri "https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/Chocolatey/ScheduleChocolateyUpgrade.ps1" -OutFile $script3; & $script2; & $script3; Remove-Item -Path $script1, $script2, $script3 -Force; Write-Output "Check the log file at C:\Install Logs\*.log";
```
4. The config.json file with all your own settings, is not removed so you can save and reuse it on other Windows machines.
## Manual Installation
1. **Download the two script files to the computer**:
```
https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/Chocolatey/Install-Configure-ScheduleChocolateyUpgrade.ps1
https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/Chocolatey/ChocolateyUpgrade.ps1
https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/Chocolatey/config.template.json
```
1. **Download these three files to your computer**:
* https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/Chocolatey/Install-Configure-ScheduleChocolateyUpgrade.ps1
* https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/Chocolatey/ChocolateyUpgrade.ps1
* https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/Chocolatey/config.template.json
2. **Set Execution Policy**: Ensure the execution policy allows the script to run.
```powershell
Set-ExecutionPolicy RemoteSigned -Scope LocalMachine
```
2. Create and Edit Configuration File: Copy the template configuration file and edit it with your values.
```sh
cp config.template.json config.json
notepad config.json
```
3. **Run the Script**: Execute the script to install and configure Chocolatey, and set up the scheduled task.
```powershell
.\Install-Configure-ScheduleChocolateyUpgrade.ps1
```
When you run the script `Install-Configure-ScheduleChocolateyUpgrade.ps1`, it will perform the following actions:
......@@ -165,10 +169,11 @@ When you run the script `Install-Configure-ScheduleChocolateyUpgrade.ps1`, it wi
- That FIPS compliant checksums was or have been enabled.
- That installation arguments is rembereed during package upgrades.
- Chocolatey sources is or already were set.
5. **Remove the Script files from the Desktop**:
```powershell
Remove-Item -Path .\ChocolateyUpgrade.ps1, .\Install-Configure-ScheduleChocolateyUpgrade.ps1, .\config.json, .\config.template.json -Force
```
## Usage
......@@ -180,7 +185,6 @@ When you run the script `ChocolateyUpgrade.ps1` or start the task `AutoUpdateCho
3. **Manage Log Files**: Keeps the latest 45 log files and removes older ones from the folder `C:\Install Logs\`.
4. **Stop Transcript**: Ends the transcript logging.
## Example Output
The script provides informative messages about its actions, such as:
- Chocolatey is already installed.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment