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
# Selecting | |
#Default | |
Get-Process | |
# All Properties | |
Get-Process | Select-Object -Property * | Out-GridView | |
# Sorting | |
# Changes the default sorting order for Get-Process | |
Get-Process | Sort-Object CPU |
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
#1 | |
Get-Service | Where-object { $_.Status -eq 'Running' -and $_.name -like 's*'} | |
#2 | |
Get-Service -name s*| Where-object { $_.Status -eq 'Running'} | |
#1 | |
Measure-Command -Expression {Get-Service | Where-object { $_.Status -eq 'Running' -and $_.name -like 's*'}} | |
#2 | |
Measure-Command -Expression {Get-Service -name s*| Where-object { $_.Status -eq 'Running'}} |
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
# Basic Syntax example | |
Get-Service | Where-Object Status -eq Running | |
# Advanced Syntax example | |
Get-Service | Where-Object {$PSItem.Status -eq 'Running' -and $PSItem.StartType -eq 'Automatic'} | |
# Same as above | |
Get-Service | Where-Object {$_.Status -eq 'Running' -and $_.StartType -eq 'Automatic'} |
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
# Enable Remoting to an Azure VM | |
Enable-PSRemoting | |
# Make sure to set the Public IP address to static or make sure you track the change of the public IP | |
# Create Network Security Group Rule to allow winrm | |
# Create a Selfsigned cert on the Azure VM | |
$Cert = New-SelfSignedCertificate -CertstoreLocation Cert:\LocalMachine\My -DnsName PC1.mydomain.local | |
Export-Certificate -Cert $Cert -FilePath '<filepath>\exch.cer' |
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
# This is the script we'll run on a regular basis | |
# Get the filehash of the CurrentDomainAdmins.xml | |
$CurrentAdminsHash = Get-FileHash -Path 'C:\scripts\CurrentDomainAdmins.xml' | | |
Select-Object -expandProperty Hash | |
# Get the current date | |
$Date = Get-Date | |
# This is the file we're testing the CurrentDomainAdmins.xml file against | |
$newAdmins = 'c:\scripts\NewAdmins.xml' | |
# A variable we will use in the if statement below |
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
# Run this once to get the Domain Admins group baseline | |
Get-ADGroupMember -Server signalwarrant.local -Identity "Domain Admins" | | |
Select-Object -ExpandProperty samaccountname | | |
Export-Clixml -Path 'C:\scripts\CurrentDomainAdmins.xml' |
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 New-AzureLab { | |
<# | |
.SYNOPSIS | |
New-AzureLab will create 1 or multiple VMs in Azure based on input parameters from a CSV | |
.DESCRIPTION | |
Create a CSV file like below: | |
VMName,Location,InterfaceName,ResourceGroupName,VMSize,ComputerName | |
SP,EastUS,SP_Int,SignalWarrant_RG,Basic_A2,SP |
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
Configuration SecurePullServerSQLDBgMSA { | |
Param ( | |
[ValidateNotNullOrEmpty()] | |
[ string ] $NodeName = 'localhost', | |
[ValidateNotNullOrEmpty()] | |
[ string ] $Thumbprint = " $( Throw "Provide a valid certificate thumbprint to continue" ) ", | |
[ValidateNotNullOrEmpty()] | |
[ string ] $Guid = " $( Throw "Provide a valid GUID to continue" ) " |
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
#!/usr/bin/python3 | |
############################################################################# | |
# # | |
# This script was initially developed by Infoxchange for internal use # | |
# and has kindly been made available to the Open Source community for # | |
# redistribution and further development under the terms of the # | |
# GNU General Public License v2: http://www.gnu.org/licenses/gpl.html # | |
# Copyright 2015 Infoxchange # | |
# # |
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 AuthN { | |
<# | |
.SYNOPSIS | |
Authenticate to Azure AD and receieve Access and Refresh Tokens. | |
.DESCRIPTION | |
Authenticate to Azure AD and receieve Access and Refresh Tokens. | |
.PARAMETER tenantID | |
(required) Azure AD TenantID. |