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
# https://twitter.com/dfinke/status/1167559940598370304 | |
$a='';1..9|%{"{0,9} x 8 + $_ = $(8*($a+=$_)+$_)"-f$a} | |
# if executing only once in a scope | |
1..9|%{"{0,9} x 8 + $_ = $(8*($a+="$_")+$_)"-f$a} |
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
{ | |
"service": { | |
"suggestion": { | |
"startmode": "Open PowerShell as administrator and run 'Set-Service -Name {0} -StartType {1}'", | |
"status": "Make the service '{0}' in {1} state." | |
}, | |
"expectedconfiguration": [ | |
{ | |
"name": "BITS", | |
"status": "running", |
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 = $True)] | |
[string]$ConfigPath | |
) | |
$Config = Get-Content -Path $ConfigPath | ConvertFrom-Json | |
Describe "Describing validation tests post deployment" { | |
Context "Post deployment validation tests for services" { | |
BeforeAll { |
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
<#PSScriptInfo | |
.VERSION 1.0.0 | |
.GUID 3b5ee706-249d-4108-8126-c8692d603ebc | |
.AUTHOR Jeffrey Snover | |
.COMPANYNAME Microsoft Corporation | |
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]$OutFilePath | |
) | |
Add-type -AssemblyName System.Drawing | |
$VirtualScreen = [System.Windows.Forms.SystemInformation]::VirtualScreen | |
$Bmp = New-Object System.Drawing.Bitmap $VirtualScreen.Width, $VirtualScreen.Height | |
$Graphic = [System.Drawing.Graphics]::FromImage($bmp) | |
$Graphic.CopyFromScreen($VirtualScreen.Left, $VirtualScreen.Top, 0, 0, $Bmp.Size) | |
$Bmp.Save($OutFilePath) |
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
<# | |
.SYNOPSIS | |
This script will help to create expressions for logging the input values of a PowerShell script. | |
.DESCRIPTION | |
This script will help to create expressions for logging the input values of a PowerShell script. | |
.EXAMPLE | |
PS C:\> .\Build-ParamLog.ps1 -Script C:\Test.PS1 -Prefix Log | |
Above execution will create expressions with prefix Log, see below. |
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
Function Get-Uptime{ | |
[CmdletBinding()] | |
param( | |
[Parameter(ValueFromPipeline = $true)] | |
[String[]]$ComputerName = $env:COMPUTERNAME | |
) | |
Begin | |
{ | |
$Output=@() |
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
<# | |
.Synopsis | |
Shows you the RSS Feeds for given URI. | |
.DESCRIPTION | |
This cmdlet Shows you RSS Feeds for a given URI.Results for this cmdlet includes Title,Link and a Short Description for specified Link. | |
.EXAMPLE | |
PS C:\WINDOWS\system32> Get-RSSFeed -Uri http://blogs.msdn.com/powershell -OutFilePath C:\Users\PR615733\Documents\RssFeedExample1.csv -OpenAfterExecution -Verbose | |
Title Link | |
----- ---- |
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
$Cred=Get-Credential;import-csv C:\powershell.org\Input.csv|select -ExpandProperty machinename |foreach{new-object psobject -Property @{'MACHIUNENAME'=$_;'OS VERSION'=$(Get-WmiObject -Class win32_operatingsystem -ComputerName $_ -Credential $cred|select -ExpandProperty caption)}}|Export-Csv C:\powershell.org\Output.csv -NoTypeInformation |
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
#Invoke-WebRequest -Uri www.telize.com/geoip|select -ExpandProperty content|ConvertFrom-Json|select longitude,latitude,country_code,timezone | |
function Get-GeoInformation | |
{ | |
[CmdletBinding()] | |
[Alias('ggeo')] | |
param( | |
[Parameter(ValueFromPipeLine=$true)] | |
[ValidateNotNull()] |
NewerOlder