This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 | |
| } |
NewerOlder