Skip to content

Instantly share code, notes, and snippets.

View noahpeltier's full-sized avatar

TismaticTech noahpeltier

View GitHub Profile
@noahpeltier
noahpeltier / Write-Log.ps1
Created April 22, 2019 21:57
Will write contents to a log with a time stamp -Error switch for writing to a seperate log for errors if need
Function Write-Log() {
[CmdletBinding()]
Param(
[switch]$Error,
[string]$Message
)
if ($Error) {
$timestamp = (get-date -uformat "%Y%m%d-%H.%M.%S -").ToString()
Add-content -path $ErrorLog -Value "$timestamp : $Message"
@noahpeltier
noahpeltier / ScanForVirusFiles.ps1
Created April 24, 2019 20:00
Scanns all local drives for files encrypted by the QQ Randsomware
$drives = @(Get-CimInstance Win32_LogicalDisk -Filter 'DriveType=3')
Write-Host "Loading Logical Drives`n$drives" -ForegroundColor Cyan
$logfile = 'C:\temp\FoundFiles.log'
$logpath = 'C:\temp'
If (!$logpath) {New-Item -ItemType Directory -Name 'temp'}
#If (!$logfile) {New-Item -ItemType Directory -Name 'FoundFiles.log'}
Write-host "Scanning Directories for files" -ForegroundColor Cyan
@noahpeltier
noahpeltier / RemoveAuvik.ps1
Created April 27, 2019 04:30
Removes Auvik WIP
$command = New-Object -TypeName System.Text.StringBuilder
$services = New-Object System.Collections.ArrayList
$AuvikPath = 'C:\Auvik'
$DHCPRunning = $null
$EventLogRunning = $null
$AuvikPathExists = $null
Function Script:DeepSearch {
$Drives = @(Get-CimInstance Win32_LogicalDisk -Filter 'DriveType=3')
@noahpeltier
noahpeltier / update time
Created April 28, 2019 20:01
updates the time in linux
sudo ntpdate 0.us.pool.ntp.org
@noahpeltier
noahpeltier / ScriptblockBuilder.ps1
Created April 30, 2019 04:42
Functino for building command strings dynamicaly to save to an array
$command = New-Object -TypeName System.Text.StringBuilder
$Array = New-Object -TypeName System.Collections.ArrayList
function set-arg {
[CmdletBinding()]
param (
[Parameter(ValueFromRemainingArguments)]
[String[]]$param,
[switch]$invoke = $false
#!/usr/bin/python3.7
"""
This will determin your OS version
and download the appropriate copy to a directory
"""
import os
import sys
import platform
import urllib.request
@noahpeltier
noahpeltier / ADSISearch.ps1
Created August 15, 2019 19:59
Class and functions for searching and settin guser info in ADSI withou tthe need for RSAT
using namespace System
using namespace System.DirectoryServices
class ADSearch
{
[Searchresult]$object
[DirectoryEntry]$DirectoryEntry
[PSCustomObject]$properties
$UserAccountControl
@noahpeltier
noahpeltier / PSEnv.ps1
Created October 28, 2019 14:19
A module I am working on to allow for installing modules to a project folder to be packaged for distribution.
function PSEnv {
[CmdletBinding()]
param (
[Parameter(ValueFromPipelineByPropertyName)]
[ValidateSet('Install', 'Init', 'Remove')]
[String]$Operation,
[parameter(ValueFromPipelineByPropertyName)]
[string]$module_name
)
@noahpeltier
noahpeltier / declutter.ps1
Created June 28, 2021 15:48
Organize files into folders by file type
(Get-ChildItem -file) | foreach {
if (!$(Test-Path $_.Extension)) {
mkdir "$($_.Extension)"
}
move-item $_.Name -Destination "$($_.Extension)" -Verbose
}
@noahpeltier
noahpeltier / software_manifest.json
Last active September 12, 2021 19:04
List of software sources
[
{
"pkgName": "obs-studio",
"displayName": "OBS Studio",
"publisher": "Open Broadcaster Software",
"publisherSite": "https://obsproject.com/",
"pkgVersion": "27.0.1",
"pkgSource": "https://cdn-fastly.obsproject.com/downloads/OBS-Studio-27.0.1-Full-Installer-x64.exe",
"hash": "844F54C4ACF1ABBD51612CC9D4470E2E3A937106E5BE69BC94BBA7859FB748CD",