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 smartComplete { | |
param ( $commandName, | |
$parameterName, | |
$wordToComplete, | |
$commandAst, | |
$fakeBoundParameters ) | |
$possibleValues = [array](Search-AzGraph -Query "resourcecontainers | where ['type'] == 'microsoft.resources/subscriptions' | project name").name | |
if ($fakeBoundParameters) { |
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 wait { $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') } | |
function line { write-host '' } | |
function getslides {param([string]$path) Get-Childitem -Path $path -Filter slide*.md} | |
function slide { | |
param( | |
[string]$path | |
) | |
$slides = getslides $path | |
foreach ($i in 0..$slides.count) { | |
$slide = Join-Path $path slide$i.md |
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-Resource { | |
param( | |
[DscProperties]$DscProperties | |
) | |
$psPath = Join-Path ([System.Environment]::SystemDirectory) 'WindowsPowerShell\v1.0\powershell.exe' | |
& $psPath -noProfile -command { | |
param( | |
$Name | |
) | |
$Env:PSModulePath += ";$PSHOME\Modules\NetSecurity" |
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 the Get function | |
function Get-Resource { | |
param( | |
[string]$status, | |
[string]$starttype | |
) | |
$service = Get-Service winmgmt | |
# Information returned by Get will be available in Azure via API | |
return @{ |
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 the Get function | |
function Get-Resource { | |
param( | |
[Parameter(Mandatory = $true)] | |
[String] | |
$Ensure, | |
[Parameter(Mandatory = $true)] | |
[string] | |
$PropertyA, | |
[Parameter(Mandatory = $true)] |
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
get-azpolicydefinition | | |
? {$_.Properties.PolicyType -eq "BuiltIn" -AND $_.Properties.DisplayName -like "*baseline*"} | | |
select policyDefinitionId -ExpandProperty Properties | | |
select policyDefinitionId, DisplayName | | |
fl |
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-AvailableMemory { | |
$Mem = '' | Select AvailableMemory | |
$Mem.AvailableMemory = Get-Counter '\Memory\Available MBytes' | % CounterSamples | % CookedValue | |
return $Mem | |
} | |
New-Alias Mem Get-AvailableMemory -Scope Global |
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 PoshMon { | |
param ( | |
[Parameter(Mandatory=$True,ValueFromPipelineByPropertyName=$True)] | |
[string]$command, | |
[Int32]$seconds = 300 | |
) | |
Begin { | |
[System.Console]::Clear() | |
[console]::CursorSize = 1 | |
$now = Get-Date |
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 copy-foldertovirtualmachine { | |
param( | |
[parameter (mandatory = $true, valuefrompipeline = $true)] | |
[string]$VMName, | |
[string]$Folder = '.\' | |
) | |
foreach ($File in (Get-ChildItem $Folder -recurse | ? Mode -ne 'd-----')){ | |
Copy-VMFile -VM (Get-VM $VMName) -SourcePath $file.fullname -DestinationPath $file.fullname -FileSource Host -CreateFullPath -Force} | |
} |
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-WSManTrust { | |
(Get-Item -Path WSMan:\localhost\Client\TrustedHosts | % Value).split(',') | |
} | |
function New-WSManTrust { | |
param( | |
[string]$hostname | |
) | |
Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value $hostname -Concatenate -Force | |
} |
NewerOlder