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 Set-IncrementDirection { | |
Param ( | |
[Parameter(Mandatory = $true, | |
Position = 0, | |
ValueFromPipeline, | |
ValueFromPipelineByPropertyName)] | |
[int]$value, | |
[switch]$decrease | |
) | |
if ($PSBoundParameters.ContainsKey('decrease')) { |
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
"Select-Expression": { | |
"prefix": "Select-Expression", | |
"body": [ | |
"Select-Object @{name='${PropertyName}';expression={{\\$_.${Property}}}" | |
], | |
"description": "Creates a PSCustomObject" | |
}, | |
"PSCustomObject": { | |
"prefix": "PSCustomObject", | |
"body": [ |
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
$users = get-aduser -filter {memberof -like '*'} -Properties memberof | |
$hash = @{} | |
foreach ($user in $users) { | |
$hash.add($user.samaccountname,$user) | |
} |
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
Discrybe 'Ma Funkshin' { | |
Context 'Checkin Piramatas' { | |
It 'Shud Gan Radge if nen priveydid' { | |
{Dee-Summit} | Shud -GanRadge | |
} | |
It 'Shud write oot to screen if piramita yoosed' { | |
Dee-Summit -String 'Ootput' | Shud -Bee 'Ootput' | |
} | |
} |
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
$content = Get-ADGroupMember -Identity 'domain admins' | select name, samaccountname | ConvertTo-Html -Fragment | |
@" | |
<html> | |
<head> | |
<title>test</title> | |
<style type='text/css'> | |
table, th, td { | |
border: 1px solid black; | |
border-collapse: collapse; |
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 Do-Something { | |
param ( | |
[Parameter(Mandatory = $True | |
Position = 0)] | |
[string]$Param1, | |
[Parameter(Mandatory = $False, | |
Position = 1)] | |
[string]$Param2 | |
) |
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 Set-CustomACL { | |
<# | |
.SYNOPSIS | |
Sets a Custom ACL on a provided folder | |
.DESCRIPTION | |
Sets ACl permissions on a provided folder recursively | |
.PARAMETER User | |
The user to add to the ACL |
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
"365-LicenseObject": { | |
"prefix": "O365-LicenseObject", | |
"body": [ | |
"\\$enabledplans = 'SHAREPOINTWAC','YAMMER_ENTERPRISE','SHAREPOINTSTANDARD'", | |
"", | |
"#Get the licensesku and create the Disabled ServicePlans object", | |
"\\$licensesku = Get-AzureADSubscribedSku | Where-Object {\\$_.SkuPartNumber -eq '${License}'} ", | |
"\r", | |
"#Loop through all the individual plans and disable all plans except the one in \\$enabledplans", | |
"\\$disabledplans = \\$licensesku.ServicePlans | ForEach-Object -Process { ", |
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 New-PassPhrase { | |
<# | |
.SYNOPSIS | |
Generate PassPhrase for account logins | |
.DESCRIPTION | |
Generate a PassPhrase from a pre-defined list of words instead of using random character passwords | |
.PARAMETER Length | |
Length of PassPhrase to be generated |
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-ADSystemInfo{ | |
<# | |
.LINK | |
https://technet.microsoft.com/en-us/library/ee198776.aspx | |
#> | |
$properties = @( | |
'UserName', | |
'ComputerName', | |
'SiteName', | |
'DomainShortName', |
OlderNewer