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
base: | |
'*': | |
- is_test_computer | |
dev: | |
'is_test_computer:True': | |
- match: pillar | |
- apps.dsconfigad | |
- apps.munki |
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 Computers by Last Logged on User via SCCM. | |
.DESCRIPTION | |
Queries SCCM for the list of computer’s whose last logged on user matches the supplied SamAccountName. | |
.PARAMETER SamAccountName | |
For users, this is typically their EUID. Non-user accounts may vary. | |
.PARAMETER SiteName | |
SCCM Server Site Name. | |
.PARAMETER SCCMServer |
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
$forestName = ([System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()).Name | |
$ADsPath = [ADSI]"GC://$forestName" | |
$Search = New-Object System.DirectoryServices.DirectorySearcher($ADsPath) | |
$Search.Filter = "(&(objectCategory=User)(SamAccountName=user0123))" | |
$Search.FindAll() |
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
try { | |
foreach ($res in $Search.FindAll()) | |
{ | |
$User = $res.GetDirectoryEntry() | |
$NewObject = New-Object PSObject | |
Add-Member -InputObject $NewObject NoteProperty 'DistinguishedName' $User.DistinguishedName | |
Add-Member -InputObject $NewObject NoteProperty 'SamAccountName' $User.SamAccountName | |
$OutputList += $NewObject | |
} |
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
[string](0..9|%{[char][int](32+("54698284737179506589").substring(($_*2),2))})-replace "\s{1}\b" |
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
#!/bin/sh | |
# Line to test if POSH is even executing | |
/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command "Get-Location | Out-File C:\Temp\test.txt" | |
if /c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command "If ((Get-AuthenticodeSignature .\install.ps1).Status -ne 'Valid') { Exit 1 }" | |
then | |
cat <<\EOF | |
The install.ps1 file has a valid signature. | |
EOF |
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 Write-Json { | |
param( | |
[Parameter( | |
Mandatory=$true, | |
HelpMessage = "Json object to be printed out in human readable format." | |
)][PSCustomObject]$Json, | |
[int]$tab=1, | |
[bool]$array=$false | |
) |
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 a { | |
param( | |
[string]$UninstallString = 'thing' | |
) | |
$MyInvocation | |
Write-Host -Fore Cyan "$($here.File) $($MyInvocation.MyCommand):$($MyInvocation.ScriptLineNumber)" | |
b | |
try { | |
Throw('Thing!!!!') |
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 | |
Gets file encoding. | |
.DESCRIPTION | |
The Get-FileEncoding function determines encoding by looking at Byte Order Mark (BOM). | |
Based on port of C# code from http://www.west-wind.com/Weblog/posts/197245.aspx | |
.OUTPUTS | |
System.Text.Encoding | |
.PARAMETER Path | |
The Path of the file that we want to check. |
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 | |
Mimics the command prompt Pause command. | |
.DESCRIPTION | |
Powershell doesn't have a Pause command that Prompts the user with "Press any key to continue..." and waits for a response. | |
This brings that command to PowerShell and allows you to customize the message. | |
.PARAMETER Message | |
The paused Message can be customzied by passing a string. | |
.INPUTS |