Skip to content

Instantly share code, notes, and snippets.

@mavericksevmont
mavericksevmont / RemoveLocalUserProfile_Edit.ps1
Created July 19, 2018 00:51
RemoveLocalUserProfile_Edit
<#
Modified by MaverickSevmont July 18th, 2018 per answer to this request:
https://gallery.technet.microsoft.com/scriptcenter/How-to-delete-user-d86ffd3c/view/Discussions/0
Written July 11, 2018
jdtherobot
I have the same wuestion as Mike McKay2 and gamer.ajay
Hopefully someone with some more knowledge comes back onto this thread.
I can verify the script works with windows 10 and deletes the registry entry as well as the profile under the users folder. I just want to find a way to get rid of the prompt for each computer and delete them all at once. otherwise I may as well select all the entries fron the users folder and babysit that if it's going to take the same amount of time.
@mavericksevmont
mavericksevmont / RemoveLocalUserProfile_Batch.ps1
Created July 19, 2018 02:27
RemoveLocalUserProfile_Batch
# Removed YES/NO confirmation prompt and added multiple server input
# Converted script to function to wrap within foreach, just edit function parameters within the foreach loop as needed.
<#
Original script: OneScript Team
Modified by: Maverick Sevmont
Notes:
Thanks to OneScript Team for the original script.
This is a quick and dirty edit in response to Q&A requests to remove YES/NO confirmation prompt and add multiple server input
More info: https://gallery.technet.microsoft.com/scriptcenter/How-to-delete-user-d86ffd3c/view/Discussions/0
@mavericksevmont
mavericksevmont / Remove-LocalUserProfiles.ps1
Created July 19, 2018 22:08
Remove-LocalUserProfiles
function Remove-LocalUserProfiles {
<#
Original script: OneScript Team
Modified by: Maverick Sevmont on July 18th, 2018
Notes: Thanks to OneScript Team for the original script: https://gallery.technet.microsoft.com/scriptcenter/How-to-delete-user-d86ffd3c/view/Discussions/0
Modifications:
1) Enclosed script as a function
2) Removed YES/NO persistent confirmation prompt
3) Added "computername" parameter to run on remote hosts by taking advantage of its WMI content
@mavericksevmont
mavericksevmont / Posh-OMRemote.ps1
Last active September 3, 2018 18:38
Blog Response: Using PowerShell To Get Physical Disk Info On A Dell Server
# This script is derived from:
# https://tech.mavericksevmont.com/blog/blog-response-using-powershell-to-get-physical-disk-info-on-a-dell-server
# Name: Posh-OMRemote.ps1
# Created by: Erick Sevilla (Maverick Sevmont)
# https://tech.mavericksevmont.com/blog/
$User = 'Contoso\Maverick1' # User variable, your user goes here
$Password = 'MyP@22w0rd' # Password variable, your password goes here
$Hostname = '192.168.77.1' # Hostname variable, the remote Dell server you'll like to query goes here
@mavericksevmont
mavericksevmont / .ps1
Created March 19, 2019 18:15
Ping-Machines
# Name: Ping-Machines
# This is a script created for educational purposes, no puppies were harmed while using write-host
# The purpose of this script is to be improved with new features, style and best practices
# https://www.youtube.com/playlist?list=PL-CiBNPRVIA2KhV94GXuIv2_nQGvyrkJs
Write-Host "Script is running" -ForegroundColor Cyan -BackgroundColor Black
$Hosts = Get-Content 'C:\temp\MyScript\Hosts.txt' # Source list of devices to ping
$Output = 'C:\temp\MyScript\PingResults.txt' # Results output file location
@mavericksevmont
mavericksevmont / GUITest.ps1
Last active January 28, 2020 16:17
PowerShell GUI test
# Form details
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Wind")
$Form = New-Object System.Windows.Forms.Form
$Form.Size = New-Object System.Drawing.Size(600,400)
# Start functions
function Get-DatePicker
{
[CmdletBinding()]
[OutputType([System.DateTime])]
Param([string]$windowTitle=$null)
Add-type -AssemblyName "System.windows.forms"
$winForm = New-object Windows.Forms.Form
if([string]::IsNullOrEmpty($windowTitle)){
$winForm.Text = "DatePicker Control"
@mavericksevmont
mavericksevmont / Invoke-SSE.ps1
Last active April 27, 2020 04:14
PowerShell and Server Side Events
#READ SERVER SIDE EVENTS
# I'll properly functionify this later
$Url = 'https://api.pipedream.com/sources/MyIDHere/sse'
$token = 'token'
$request = [System.Net.WebRequest]::CreateHttp($Url)
$request.Headers.Add("Authorization", "Bearer $token")
$request.AllowReadStreamBuffering = $false
$response = $request.GetResponse()
$stream = $response.GetResponseStream()
@mavericksevmont
mavericksevmont / books.md
Created May 30, 2020 21:50 — forked from abstractart/books.md
Free Programming Ebooks - O'Reilly Media. Codeship free ebooks here - https://bit.ly/2oQ0knQ