Skip to content

Instantly share code, notes, and snippets.

@ekmixon
ekmixon / PS-Filtering.ps1
Created October 4, 2021 18:07 — forked from signalwarrant/PS-Filtering.ps1
PS-Filtering.ps1
# 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'}
@ekmixon
ekmixon / Enable-Remoting.ps1
Created October 4, 2021 18:07 — forked from signalwarrant/Enable-Remoting.ps1
Enable-Remoting.ps1
# 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'
@ekmixon
ekmixon / Find-AdminGroupChanges.ps1
Created October 4, 2021 18:07 — forked from signalwarrant/Find-AdminGroupChanges.ps1
Find-AdminGroupChanges.ps1
# 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
@ekmixon
ekmixon / Get-DomainAdmins.ps1
Created October 4, 2021 18:07 — forked from signalwarrant/Get-DomainAdmins.ps1
Get-DomainAdmins.ps1
# 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'
@ekmixon
ekmixon / New-AzureLab.ps1
Created October 4, 2021 18:07 — forked from signalwarrant/New-AzureLab.ps1
New-AzureLab.ps1
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
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" ) "
@ekmixon
ekmixon / Get-3rdPartySoftware.ps1
Created October 4, 2021 18:07 — forked from signalwarrant/Get-3rdPartySoftware.ps1
Get-3rdPartySoftware.ps1
<#
.DESCRIPTION
Uses some WMI and reading some Registry keys to get the version numbers for
McAfee Security Center, DAT, HIP, Plash Player, Java, Adobe Acrobat, Reader and AIR.
All of the results are put into a CSV file with the computername, IP Address, MAC Address and Serial Number
.NOTES
File Name: get-3rdPartySoftware.ps1
Author: David Hall
Contact Info:
@ekmixon
ekmixon / Force-WSUScheckin.ps1
Created October 4, 2021 18:07 — forked from signalwarrant/Force-WSUScheckin.ps1
Force-WSUSchechin.ps1
# *** THIS SCRIPT IS PROVIDED WITHOUT WARRANTY, USE AT YOUR OWN RISK ***
<#
.DESCRIPTION
Starts the Windows Update service (wuauserv) if it is stopped and forces a checkin with the WSUS Server.
This function uses the Invoke-Command CMDlet which will require PSRemoting to be enabled on the target machine.
.NOTES
File Name: force-WSUScheckin.ps1
Author: David Hall
Contact Info:
@ekmixon
ekmixon / Get-Help.ps1
Created October 4, 2021 18:07 — forked from signalwarrant/Get-Help.ps1
Get-Help.ps1
# Update all of the helpfiles
Update-Help
# Find all the modules that accept updated help
Get-Module -ListAvailable | Where-Object HelpInfoUri
# Save the help files to the local machine
Save-help -Force -DestinationPath 'D:\SaveHelp'
# Use either command below to access helpfiles
# Get all Modules, Functions, Alias' ...etc available on your computer
Get-Command -all
# Search for all cmdlets that contain Service in the noun portion.
Get-command –noun Service
# Search for all cmdlets that contain Stop in the verb portion
Get-Command -Verb Stop
# You can also use the * character as a wildcard