Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snippets
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Lindemark
snippets
Commits
78780497
Commit
78780497
authored
2 months ago
by
Andreas Lindemark
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Windows/Chocolatey/README.md
+13
-9
13 additions, 9 deletions
Windows/Chocolatey/README.md
with
13 additions
and
9 deletions
Windows/Chocolatey/README.md
+
13
−
9
View file @
78780497
...
...
@@ -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:
\I
nstall Logs
\`
.
4.
**Stop Transcript**
: Ends the transcript logging.
## Example Output
The script provides informative messages about its actions, such as:
-
Chocolatey is already installed.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment