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
[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
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
$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
<# | |
.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
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
{% for computer in 'TEST001','TEST002','TEST003' %} | |
{% if grains['nodename'] == computer %} | |
is_test_computer: True | |
{% else %} | |
is_test_computer: False | |
{% endif %} | |
{% else %} | |
is_test_computer: False | |
{% endfor %} |
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] $RootOU = 'OU=test,DC=domain,DC=com' | |
[string] $Path = 'OU=foo' | |
try { | |
$ou_exists = [adsi]::Exists("LDAP://$Path") | |
} catch { | |
# If invalid format, error is thrown. | |
Write-Debug "Supplied Path is invalid.`n$_" | |
# It's probably the abbreviated version, so let's tack on the Root OU and confirm exists. | |
Write-Debug 'Placing Path in Root OU and re-verifying ...' | |
$Path = "$Path,$RootOU" |
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] $Path = 'OU=foo,OU=test,DC=domain,DC=com' | |
try { | |
$ou_exists = [adsi]::Exists("LDAP://$Path") | |
} catch { | |
# If invalid format, error is thrown. | |
Throw("Supplied Path is invalid.`n$_") | |
} | |
if (-not $ou_exists) { | |
Throw('Supplied Path does not exist.') |
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 ( | |
[parameter( | |
Position = 0, | |
Mandatory = $true, | |
HelpMessage = 'This is the version number, such as "22.0". Valid version numbers can be found here: http://mzl.la/1c9hPmo' | |
)] | |
[string] $version, | |
[parameter( | |
Position = 1, | |
Mandatory = $false, |