Tag

#PowerShell

Cleanup All User Chrome Cache

October 30, 2018

This script will clean all Chrome cache for all users on a Windows 7 or newer system. # Define the base directory for user profiles$usersPath = "C:\Users"$totalBeforeCleanup =…

Get RDS-CAL License Details (2008 RDS License Server)

August 20, 2018

Get current RDS-CAL details via PowerShell. Run this from your 2008 RDS Licensing server. # Filename of the export $filename = RDS-CAL-Report.csv # Import RDS PowerShell Module import-module…

Allscripts Vision User Reporting

August 2, 2018

A quick Powershell script I hacked together that will enumerate all Active Directory users, and build an XML file for an application I wrote that generates user reports…

Cleanup Windows User Temporary Files

October 30, 2017

This script will cleanup all users temporary files in their AppData\Local\Temp for Windows 7 and newer. # Define the base directory for user profiles$usersPath = "C:\Users"$totalBeforeCleanup = 0$totalAfterCleanup…

Powershell logparse regexp to csv

April 19, 2017

Input line: Thu 2017-03-30 00:00:07: user@domain.com (John Doe) checked mail from 127.0.0.1 using IMAP, 0 msgs collected, 21 remaining Powershell script: $rxp = "([a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)|(d{1,3}.d{1,3}.d{1,3}.d{1,3})|(POP|IMAP)|(^[A-Z][a-z]+sd{4}-d{2}-d{2}sd{2}:d{2}:d{2})" gc ".*.log" | select-string…

Remove Windows Defender from Server 2016

January 26, 2017

I have my own security software I use on Windows Server operating systems and take out Windows Defender.  Normally, I can do this through Feature removal, but the…

Join Nano Server to a Domain

April 28, 2016

To join my Windows Server 2016 Nano server to my test domain I used the djoin.exe (Domain Join) command. From a domain controller, or server already joined to my…

Create Nano Server Image

April 28, 2016

I was trying to build a Nano Server image (2016 Tech Preview 5) and kept getting the following error: Turns out that is because the documentation is not…

Clearing Command and Buffer History in Powershell

January 15, 2015

Clear Powershell’s last 10 commands: clear-history -count 10 -newest After executing that, use get-history to see what’s left… Clear the console buffer by scripting F7+2: [system.reflection.assembly]::loadwithpartialname("System.Windows.Forms") [System.Windows.Forms.SendKeys]::Sendwait('%{F7 2}')…

Use Runas in a Batch Script

June 27, 2014

Runas does not accept a password on the command line, nor can you pipe it to it on STDIN. It requires keyboard input. However, to make life easier,…

CryptoLocker Software Restriction Policies

May 27, 2014

Identification of Cryptolocker Location of CryptoLocker binaries: %AppData%<random>.exe %LocalAppData%<random>.exe If the malware has executed, one or more of the following registry keys will be present: HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun CryptoLocker HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun…