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
<# | |
.SYNOPSIS | |
An MTR clone for PowerShell. | |
Written by Tyler Applebaum. | |
Version 2.1 | |
.LINK | |
https://gist.github.com/tylerapplebaum/dc527a3bd875f11871e2 | |
http://www.team-cymru.org/IP-ASN-mapping.html#dns |
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
<# | |
.SYNOPSIS | |
Backup-CiscoConfig.ps1 SSHs to a Cisco device and backs up the running configuration to a TFTP server.. Utilizes the Posh-SSH module. | |
.DESCRIPTION | |
This script is not possible without darkoperator's Posh-SSH module. Thanks! | |
To do: Parameterize the device list. 10/05/16 | |
Grab the output of long commands by setting the terminal length to 0 to disable pagination. "term len 0" | |
Log commands entered on the Cisco device to ensure they're running: |
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
<# | |
.SYNOPSIS | |
Create realistic-looking Active Directory accounts. | |
Written by Tyler Applebaum. | |
Version 0.2 | |
Last Updated Jun 17 2020 | |
.LINK | |
https://gist.github.com/tylerapplebaum/d692d9d2e1335b8b111927c8292c5dac | |
https://randomuser.me/ |
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
#Checks the status of $ServiceName and kills it if in the 'Stop Pending' state. | |
#Creates an event log; logs results to it | |
#Get-Random (Get-Service | Select-Object -ExpandProperty Name) | Kill-HungService -Verbose | |
Function script:Kill-HungService { | |
[CmdletBinding()] | |
param( | |
[Parameter(ValueFromPipeline=$True,Mandatory=$True,HelpMessage="Service to search for")] | |
[string]$script:ServiceName | |
) |
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 script:Invoke-Credentials { | |
[CmdletBinding()] | |
param( | |
[Parameter(HelpMessage="Specify the username for the stored credential")] | |
[ValidateNotNullOrEmpty()] | |
[string]$Script_Username = "svc.username", #Username goes here | |
[Parameter(HelpMessage="Specify the path to store the credential")] | |
[ValidateNotNullOrEmpty()] | |
[string]$Script_CredFolder = "C:\Automate\", |
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 Convert-ToBase64 { | |
param( | |
[CmdletBinding()] | |
[Parameter(ValueFromPipeline=$True,Mandatory=$True,HelpMessage="String to encode to base64")] | |
[ValidateNotNullOrEmpty()] | |
$String | |
) | |
$StringToByteArr = [System.Text.Encoding]::UTF8.GetBytes($String) #Converts string to byte array | |
$Base64String = [System.Convert]::ToBase64String($StringToByteArr) #Converts byte array to b64 string |
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-StringHash { | |
param( | |
[CmdletBinding()] | |
[Parameter(ValueFromPipeline=$True,Mandatory=$True,HelpMessage="String to hash")] | |
$String, | |
[Parameter(HelpMessage="Hash algorithm")] | |
[ValidateSet('MD5','RIPEMD160','SHA1','SHA256','SHA384','SHA512')] | |
$Algorithm = "SHA1" | |
) | |
$StringBuilder = New-Object System.Text.StringBuilder |
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
; No longer needed - embedded in script now | |
[version] | |
Signature=$chicago$ | |
AdvancedINF=2.5 | |
[DefaultInstall] | |
CustomDestination=CustInstDestSectionAllUsers | |
RunPreSetupCommands=RunPreSetupCommandsSection | |
[RunPreSetupCommandsSection] |
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-UserGroups { | |
<# | |
.EXAMPLE | |
PS C:\> Get-UserGroups -GroupName "Domain Admins" | |
.EXAMPLE | |
PS C:\> [bool](Get-UserGroups -GroupName "Domain") | |
.EXAMPLE | |
PS C:\> Get-UserGroups -UserName [email protected] |
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 Resolve-EstablishedConnections { | |
$EstConnections = Get-NetTCPConnection -State Established | |
$ConnectionArr = New-Object System.Collections.ArrayList #Initialize the ArrayList | |
$Counter = 1 | |
ForEach ($Connection in $EstConnections) { | |
Write-Progress -Activity "Resolving PTR Record" -Status "Looking up $($Connection.RemoteAddress)" -PercentComplete ($Counter / $($EstConnections.Length)*100) | |
$ConnectionObj = [PSCustomObject][Ordered] @{ | |
LocalAddress = $Connection.LocalAddress |
OlderNewer