Skip to content

Instantly share code, notes, and snippets.

View simstems's full-sized avatar

Stephen Morrison simstems

View GitHub Profile
@simstems
simstems / AmmoCounterTest.cc
Last active June 7, 2018 02:58
Turns an LED on for as long as the IR sensor (by Ammo Counter) is crossed.
/*
AmmoCounterTest
Turns an LED on for as long as the IR sensor is crossed.
modified 8 June 2018
by Stephen Morrison
GNU GENERAL PUBLIC LICENSE
@simstems
simstems / PowerPy.py
Last active October 26, 2022 21:08
Demonstrate how to use PowerShell in Python to get a full path to a specific file under the current user.
# Demonstrate how to use PowerShell in Python to get a full path to a specific file under the current user.
import subprocess
#Functions
def RunCommand(Command):
process = subprocess.Popen(["powershell", Command], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
output = process.stdout.readlines()
return output
def get_Path(path):
cleanPath = RunCommand(path)
@simstems
simstems / BulkReplacer.py
Last active July 24, 2024 21:29
Bulk find and replace text in a .txt file using python
# A.I. assisted with the creation of this code.
import sys
import os
import re
import random
import string
from pykml import parser
import pandas as pd
# Patterns to match
@simstems
simstems / Get-Info.ps1
Last active June 5, 2025 22:23
Get PC info using PowerShell (Name, Brand, Model, Serial)
Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object Name, Manufacturer, Model
wmic bios get serialnumber
Enter-PSSession -ComputerName <servername>
gpupdate /force
# Install-Module -Name PSWindowsUpdate -Force
Import-Module PSWindowsUpdate
Get-WindowsUpdate
Install-WindowsUpdate -AcceptAll -AutoReboot
# Restart-Computer -Force
Invoke-Command -ComputerName <RemoteComputerName> -ScriptBlock {
Import-Module PSWindowsUpdate
Get-WindowsUpdate -AcceptAll -Install -AutoReboot | Out-File C:\Windows\PSWindowsUpdate.log
}
<#
Invoke-Command -ComputerName REMOTEPC -ScriptBlock {
Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object Name, Manufacturer, Model
Get-CimInstance -ClassName Win32_BIOS | Select-Object -ExpandProperty SerialNumber
}
#>
Invoke-Command -ComputerName REMOTEPC -ScriptBlock {
@simstems
simstems / Re-PW-Session.ps1
Created July 17, 2025 13:35
Traverse windows directory on remote computer via PowerShell
Enter-PSSession -ComputerName <RemoteComputerName> -Credential (Get-Credential)
@simstems
simstems / Get-Drive-Info.ps1
Created July 17, 2025 16:36
Drive Info Commands
Get-PhysicalDisk | Select-Object DeviceID,FriendlyName,MediaType,BusType,@{Name='Size(GB)';Expression={"{0:N1}" -f ($_.Size/1GB)}} | Format-Table -AutoSize
Get-Partition | Format-Table -AutoSize
@simstems
simstems / Local-Admin.ps1
Created July 21, 2025 13:16
Add user ad local administrator
Add-LocalGroupMember -Group "Administrators" -Member "DomainName\UserName"