Skip to content

Go-Jenkins

Changes to the Jenkins home directory

#requires -version 5.1

try {
	if (Test-Path "~/.jenkins" -pathType container) {
		$path = "~/.jenkins"
	} elseif (Test-Path "/var/snap/jenkins" -pathType container) {
		$path = "/var/snap/jenkins"
	} else {
		throw "No Jenkins home directory found - Please install Jenkins"
	}
	Set-Location "$path"
	$files = Get-ChildItem $path -attributes !Directory
	$folders = Get-ChildItem $path -attributes Directory
	"??$path entered (has $($files.Count) files and $($folders.Count) folders)"
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0])"
	exit 1
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.