There are several options to run recipes:
- using chef-client with -z option
- using chef-apply
- using chef-solo
Before running Chef recipes on the machine, it should be prepared:
| $securePass = Read-Host -AsSecureString -Prompt "Enter sudo password" | |
| $securePass | .\script.ps1 | |
| [CmdletBinding()] | |
| param( | |
| [Parameter(ValueFromPipeline = $true)] | |
| [System.Security.SecureString]$PipedPassword |
| (Get-ChildItem -Force $pwd).name | | |
| ForEach-Object { | |
| $chars = $_.ToCharArray() | ForEach-Object { [int]$_ } | |
| "'$_' → $($chars -join ',')" | |
| } |
| Get-ChildItem "$env:LOCALAPPDATA\Packages" -Recurse -Filter ext4.vhdx -ErrorAction SilentlyContinue | Select-Object FullName |
| // Run from Jenkins Script Console | |
| Jenkins.instance.getAllItems().each { it.builds.findAll { it.result == Result.FAILURE}.each { println(it); it.delete() } } |