Skip to content

Instantly share code, notes, and snippets.

View realslacker's full-sized avatar

Shannon Graybrook realslacker

View GitHub Profile
<#PSScriptInfo
.VERSION 2019.3.25.900
.GUID cd6e3726-52d2-4ae0-b423-1d4d8853775f
.AUTHOR Shannon Graybrook
.COMPANYNAME Methode Electronics
@realslacker
realslacker / PSmRemoteNG.psd1
Last active September 20, 2019 21:15
Latest version available now on GitHub -> https://github.com/realslacker/PSmRemoteNG
#
# Module manifest for module 'PSmRemoteNG'
#
# Generated by: Shannon Graybrook
#
# Generated on: 7/18/2019
#
@{
@realslacker
realslacker / Invoke-GPOScriptReport.ps1
Created May 20, 2019 19:49
Get all Group Policy Objects with scripts
Import-Module GroupPolicy -ErrorAction Stop
Get-GPO -All |
ForEach-Object { Write-Host ( 'Processing GPO ''{0}''...' -f $_.DisplayName ); $_ } -pv 'GPO' |
Get-GPOReport -ReportType Xml |
ForEach-Object { [xml]$_ } |
foreach-Object {
$_.GPO.User.ExtensionData |
Where-Object { $_.Name -eq 'Scripts' } |
@realslacker
realslacker / mRemoteNG-Password-Util.psm1
Last active November 15, 2020 18:59
Work with mRemoteNG passwords... Functionality has been rolled into https://github.com/realslacker/PSmRemoteNG
Add-Type -Path 'C:\Program Files (x86)\mRemoteNG\BouncyCastle.Crypto.dll'
function ConvertFrom-MRNGSecurePassword {
param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]
$EncryptedMessage,
@realslacker
realslacker / WmiNameSpaceSecurity.psm1
Created April 16, 2019 20:01
A module with expanded functionality base on original work by Steve Lee and Graeme Bray. See Set-WMINameSpaceSecurity.ps1 for original.
<#
Disclaimer:
This module is provided AS IS without warranty of any kind. This work is based off work by
other talented individuals, and should not be considered an original work.
Modified into module by Shannon Graybrook
Modified by Graeme Bray
Original Content by Steve Lee
@realslacker
realslacker / wmi_filters.ps1
Created February 23, 2019 22:12
WMI Filters
# filter for server core
$Query = 'SELECT * FROM Win32_OptionalFeature WHERE Caption = "Microsoft-Windows-Server-Gui-Shell-Package-DisplayName" AND InstallState = "2"'
Get-WmiObject -Query $Query
@realslacker
realslacker / Restart-ComputerWhen.ps1
Created February 22, 2019 16:47
Schedule a restart at a specific time
# the same script as a one liner:
# shutdown -r -t ( [math]::Ceiling( ([datetime]"1PM").Subtract((Get-Date)).TotalSeconds )
param(
[Parameter(Mandatory=$true)]
[datetime]
$When
)
$Now = Get-Date
@realslacker
realslacker / PowerShell Menu Fixes.reg
Created January 12, 2019 01:39
Changes PowerShell right click menu items so that it (1) doesn't try to change the execution policy and (2) add's run as and run as user options for scripts.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1]
"EditFlags"=dword:00020000
"FriendlyTypeName"=hex(2):40,00,22,00,25,00,73,00,79,00,73,00,74,00,65,00,6d,\
00,72,00,6f,00,6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,\
33,00,32,00,5c,00,77,00,69,00,6e,00,64,00,6f,00,77,00,73,00,70,00,6f,00,77,\
00,65,00,72,00,73,00,68,00,65,00,6c,00,6c,00,5c,00,76,00,31,00,2e,00,30,00,\
5c,00,70,00,6f,00,77,00,65,00,72,00,73,00,68,00,65,00,6c,00,6c,00,2e,00,65,\
00,78,00,65,00,22,00,2c,00,2d,00,31,00,30,00,33,00,00,00
@ECHO OFF
SET mytime=%time: =0%
SET dtstamp=%date:~-4%%date:~4,2%%date:~7,2%%mytime:~0,2%%time:~3,2%%time:~6,2%
notepad %TEMP%\cert_%dtstamp%.req
certreq -submit -attrib "CertificateTemplate:WebServer10Y" %TEMP%\cert_%dtstamp%.req %TEMP%\cert_%dtstamp%.cer
notepad %TEMP%\cert_%dtstamp%.cer
SET /P answer=Save the generated certificate? (y/N)
@realslacker
realslacker / clear icon cache.cmd
Created October 31, 2018 15:29
Clear the icon cache to fix Windows 10 start menu icons
ie4uinit.exe -ClearIconCache
taskkill /IM explorer.exe /F
DEL "%localappdata%\IconCache.db" /A
explorer