sudo snap install powershell --classic --channel=edge/useedge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f13d5fd1-fa6a-4f9e-88d4-8b15ea0dba4c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[string] | |
$ModuleName = 'nimbus' | |
) | |
$module = Get-Module -ListAvailable $ModuleName | Sort-Object -Descending Version | Select-object -First 1 | |
if(!$module) | |
{ | |
throw "Module $module not found" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[parameter(Mandatory)] | |
[string]$Url, | |
[parameter(Mandatory)] | |
[string]$Pat, | |
[parameter(Mandatory)] | |
[string]$Pool | |
) | |
$ErrorActionPreference = 'stop' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process | |
Invoke-WebRequest -Uri https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 -OutFile install-powershell.ps1 | |
./install-powershell.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[uri] $sasUrl, | |
[string] $path, | |
[string] $container = 'signing-upload' | |
) | |
$filename = split-path -leaf $path | |
$newurl=[System.UriBuilder]::new($sasurl) | |
$newurl.path="/$container/$filename" |
Originally by Keith Babinec, published a MSDN.
Current version is moved to by blog here
Today’s post (and this blog's inaugural post!) is An Introduction to Error Handling in PowerShell. We will discuss error types, the $error
variable, error action preferences, try/catch blocks, and $lastexitcode.
The first requirement is to understand the types of errors that can occur during execution.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Describe 'verify testdrive:' { | |
BeforeAll { | |
$testPath = 'TestDrive:/test.txt' | |
'test' | out-file -path $testPath | |
} | |
it 'verify file' { | |
Get-Content -path $testPath | should -be 'test' | |
} |
Operatinig System | Status | Version | Notes |
---|---|---|---|
Ubuntu 14.04 LTS+ | Supported | 2.23 | |
Debian (testing and unstable) | Supported | 2.23 | |
Gentoo | Supported | 2.15 | Not verified |
Fedora 25+ | No Classic Support | 2.28.5 | no-classic |
CentOS 7 | No Classic Support | N/A | no-classic |
RHEL 7 | No Classic Support | N/A | N/A |
Arch Linux | No Classic Support | 2.30 | no-classic |
openSUSE | Unsupported | 2.23.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This is intended for Win7/Windows Server 2008 R2 sysprep issues with WMF 5.x | |
$Path ='HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\Sysprep\Generalize' | |
$acl=Get-Acl -Path $Path | |
$rights = $acl.Access|?{$_.IdentityReference -eq 'BUILTIN\Administrators'} | Select-Object -ExpandProperty RegistryRights | |
if($rights -ne 'FullControl') | |
{ | |
throw "Please give administrators full control to $Path" | |
} |
NewerOlder