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 Format-Member { | |
[CmdletBinding()] | |
[alias("fm")] | |
param ( | |
[parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)] | |
[System.Management.Automation.PSObject] | |
$InputObject | |
) |
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
filter Find-PipelineParameters { | |
param ( | |
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)] | |
[System.Management.Automation.CommandInfo] $CommandInfo | |
) | |
$commandInfo.Parameters.Values | Where-Object { | |
$parameterAttribute = $_.Attributes | | |
Where-Object { $_ -is [Parameter] } | |
$parameterAttribute.ValueFromPipeline -or $parameterAttribute.ValueFromPipelineByPropertyName | |
} |
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
enum EventName { | |
Created | |
Changed | |
Deleted | |
Renamed | |
} | |
function Invoke-FileSystemWatcher { | |
[CmdletBinding()] | |
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
class AwsInstance { | |
[String] $TagName | |
[String] $InstanceId | |
[String] $Status | |
Hidden [Object] $EC2Instance | |
AwsInstance([String]$name) { | |
if ($name -match '^i-[a-f0-9]+$') { | |
$this.InstanceId = $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
filter Get-DinoPW { | |
param ( | |
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)] | |
[ValidateSet('Simple', 'Strong')] | |
$SetPwStrength | |
) | |
$uri = switch ($SetPwStrength) { | |
'Simple' { 'http://www.dinopass.com/password/simple' } | |
'Strong' { 'http://www.dinopass.com/password/strong' } | |
} |
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-NameInBinary { | |
param( | |
[parameter(DontShow)] # hide paramter to allow read host to promt for name(s) | |
[string]$name = $(read-host -Prompt "Enter Name(s)") | |
) | |
# Pass name from function to screen | |
"Your Name '{0}' in Binary is : " -f $name | |
# get the value of whitespace in binary to seperate names, surnames or middle names |
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-age { | |
param( | |
[Parameter(Mandatory=$true, | |
HelpMessage="Date must be written as dd/mm/yy", | |
Position=0)] | |
[ValidatePattern("^(0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/(\d{2})$")] | |
[string]$Bday | |
) | |
Begin { |
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 | |
Get deployment status of application | |
.DESCRIPTION | |
By querying the SCCM WMI class of "SMS_AppDeploymentAssetDetails", can obtain the status of a deployment. | |
Adding the application name and the collection of which the application was targeted, status results can be obtained. | |
A filter is set for the 5 status results which the MSDN documentation stats are avaiable. | |
.LINK | |
Please see 'https://msdn.microsoft.com/en-us/library/hh948459.aspx' for the class details of "SMS_AppDeploymentAssetDetails" | |
.EXAMPLES | |
5 examples available: |
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 | |
Find where an application has been deployed to. | |
.DESCRIPTION | |
To determine which collection an application has been deployed to. Results will show Name of application, the deployment ID | |
and the collection the application has been deployed to. | |
.EXAMPLE | |
get-AppDeployedToCollection -Application 'Microsoft Office 2016' | |
.OUTPUTS | |
Application_Name DeploymentID Deployed_To_Collection | |
---------------- ------------ ---------------------- |
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 | |
Find where an application has been deployed to. | |
.DESCRIPTION | |
To determine which collection an application has been deployed to. Results will show Name of application, the deployment ID | |
and the collection the application has been deployed to. | |
.EXAMPLE | |
get-AppDeployedToCollection -Application 'Microsoft Office 2016' | |
.OUTPUTS | |
Application_Name DeploymentID Deployed_To_Collection | |
---------------- ------------ ---------------------- |