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
$disks = Get-WmiObject -ClassName Win32_LogicalDisk | |
ForEach ($disk in $disks) { | |
$FreeSpace = [Math]::Round($disk.FreeSpace / 1GB, 2) | |
$UsedSpace = [Math]::Round(($Disk.Size - $disk.FreeSpace) / 1GB, 2) | |
New-UDColumn -Content { | |
New-UdChart -Title $Disk.DeviceId -Type Doughnut -Endpoint { | |
[PSCustomObject]@{Space = $UsedSpace; Name = "UsedSpace"}, | |
[PSCustomObject]@{Space = $FreeSpace; Name = "FreeSpace"} | | |
Out-UDChartData -DataProperty "Space" -LabelProperty "Name" | |
} |
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
{"lastUpload":"2017-08-24T02:59:49.349Z","extensionVersion":"v2.8.3"} |
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 Test-DynamicParameter | |
{ | |
[CmdletBinding()] | |
PARAM | |
( | |
[string[]] | |
$Param1, | |
# this parameter seems to cause the problem - if I specify [string] then tab-completion works for -DynamicParameter | |
[PSCredential] |
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 Test-ADStaffAttributes { | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Mandatory = $true)] | |
[Microsoft.ActiveDirectory.Management.ADUser] | |
$Identity, | |
[switch] | |
$Quiet |
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
$PowerShell = [powershell]::Create() | |
$null = $PowerShell.AddScript({ | |
param($Credential) | |
$ExchParams = @{ | |
ConfigurationName = 'microsoft.exchange' | |
ConnectionUri = "https://outlook.office365.com/powershell-liveid/" | |
Credential = $Credential | |
Authentication = 'Basic' |
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 up a test command | |
function Test-MyCompleter { | |
param | |
( | |
[string[]] | |
$Param1 | |
) | |
} | |
# register the completer |
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 | |
( | |
[PSCredential] | |
$Credential, | |
[string] | |
$TenantName, | |
[int] | |
$PreservationDurationInDays, |
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
Import-Module OneLogin | |
$Credential = Get-Credential | |
$Token = New-OneLoginToken -Credential $Credential -Region us -SetAsDefault | |
$Events = Get-OneLoginEvent -Since (Get-Date).AddHours(-1) |
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
<# | |
.DESCRIPTION | |
Finds all users in Active Directory with passwords close to expiring | |
and notifies them via email. Also creates and sends a report that includes all | |
expired and expiring passwords. | |
#> | |
#Requires -Version 3.0 | |
#Requires -Module ActiveDirectory | |
param |
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 up a simple array | |
$Items = @( | |
[PSCustomObject]@{Name = 'Item1'; SomeProperty = "1"}, | |
[PSCustomObject]@{Name = 'Item2'; SomeProperty = "2"}, | |
[PSCustomObject]@{Name = 'Item3'; SomeProperty = "3"} | |
) | |
### enumerate a property of the objects passed in via -ArgumentList | |
# the output here is always '2' |