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-SamAccountName { | |
param ($DisplayName) | |
Get-QADUser -DisplayName "*$DisplayName*" | select samaccountname, displayname, office, telephonenumber | |
} |
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-RealName { | |
param ($SAMAccountName) | |
Get-QADUser -SamAccountName $SAMAccountName | select samaccountname, displayname, office, telephonenumber | |
} |
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 Reset-RDPListener { | |
param($ComputerName) | |
$ts = Get-WMIObject -class win32_Terminalservicesetting -comp $ComputerName | |
$ts.SetAllowTSConnections($false) | |
$ts.SetAllowTSConnections($true) | |
} |
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
$DN = 'CN=Username,OU=OrganizationalUnit,DC=lab,DC=local' | |
$pattern = '(?i)DC=\w{1,}?\b' | |
([RegEx]::Matches($DN, $pattern) | ForEach-Object { $_.Value }) -join ',' |
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
# Courtesy of /u/LordZillion from /r/PowerShell | |
$Users = Import-Csv -Path C:\Temp\AllTheUsers.csv | |
$HashTable = @{} | |
Foreach($User in $Users) { | |
[int]$HashTableReference = $User.ExternalID | |
$HashTable[$HashTableReference] += New-Object -TypeName PSObject -Property @{ | |
'UserName' = ($User.UserName); | |
'Password' = ($User.Password); | |
'Email' = ($User.Email); |
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-STTinyURL { | |
param( | |
[Parameter(Mandatory=$true, | |
ValueFromPipeline=$true, | |
Position=0) | |
] | |
[String[]]$OriginalURL) | |
Process { | |
$OriginalURL | ForEach-Object { |
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
$buttonStartJob_Click={ | |
$buttonStartJob.Enabled = $false | |
#Create a New Job using the Job Tracker | |
Add-JobTracker -Name "JobName" ` | |
-JobScript { | |
#-------------------------------------------------- | |
#TODO: Set a script block | |
#Important: Do not access form controls from this script block. |
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 Create-HashTable { | |
param ($filePath) | |
$mytable = Import-Csv -Path $filePath | |
$HashTable=@{} | |
foreach($r in $mytable) | |
{ | |
$HashTable[$r.Name] = $r.ID | |
} | |
return $HashTable | |
} |
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
# functions.ps1 contains functions like Get-Services, Get-Process, | |
# Get-CustomFunction1, Get-CustomFunction2, etc. that execute | |
# locally on the remote computer. Output is ex | |
function Get-CustomFunction { | |
sleep 2 | |
write-output $true | |
} |
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-RSFileHash { | |
<# | |
.Synopsis | |
Returns an MD5 filehash when given a file path | |
.DESCRIPTION | |
Returns an MD5 filehash when given a file path | |
.EXAMPLE | |
Get-RSFileHash -Filename c:\temp\filetohash.txt | |
.EXAMPLE | |
Get-ChildItem c:\temp\*.txt | get-rsfilehash |
OlderNewer