Category: Codes

Quick 1-liner: get system model number

# the 1-linerwmic computersystem get model,name,manufacturer,systemtype# Get RAM DIMM Slotswmic memorychip get Capacity /format:list

Restore User Script

echo offSET RAR="C:\Program Files\WinRAR\RAR.EXE"IF NOT EXIST P:\ (NET USE P: \\WDFS1\BACKUP)cd %USERPROFILE%%RAR% x -y p:\%username%\desktopstuff.rarC:cd…

Quick 1-liner Generate List of Active Directory users

# Discover domain controller:echo %LOGONSERVER%# Display Users:dsquery user -limit 0 | dsget user -display -dept…

Daily database backup.bat

@echo offif %USERNAME%==Administrator echo you are administratorset RAREXEC="C:\Program Files\WinRAR\WinRar.exe"set RAREXEC="C:\Program Files\WinRAR\Rar.exe"set LOGFILE="c:\sys\backup.log"SET ARG1=%1IF EXIST D:\…

Script to Disable User Accounts

accountsToDisable.txtorangeapplepeartermed user REM disableAccounts.batREM read accountsToDisable.txt and convert names into proper DN entries. Save result…

Script to Backup Exchange Server

REM exchange.txtD:\Exchange2010\mailbox\TempDatabaseD:\Exchange2010\mailbox\Mailbox-Database-20150403D:\Exchange2010\mailbox\Public Folder Database 1998117930 REM exchangebackup.batecho offnet use S: \\FILESERVER01\backups\EXCHANGE-2010REM -------------------------------------------------------REM PARSE THE DATE…

Script to use WinRAR for backups

REM winrar_backup.batecho offSET FNAME=KIMCONNECTSET LOGFILE=\\FILESERVER01\backup\ads-02-backup.txtIF EXIST V:\ (NET USE V: /DELETE)net use v: \\FILESERVER01\backupIF %ERRORLEVEL%…

Logon Scripts

Purposes: Mapping network drives Installing and setting a user’s default printer Collecting computer system information…

Use psexec to install application remotely

psexec @ComputerList.txt -u domain\administrator cmd /s /c "xcopy "\\NetworkPath\Forefront Software\Install.exe" "C:\Windows" && Install.exe /u /s…

PowerShell: Error when Pause is Placed Inside Function

Error: + Function Search-ScheduledTasks{+ ~Missing closing '}' in statement block or type definition.At C:\Users\kdoan\Desktop\Notes\test.ps1:57 char:1+…

Increase Windows Management Instrumentation Service Handle Quota Limit

WMI.ps1----------------------------------------------$config = gwmi -Class "__ProviderHostQuotaConfiguration" -Namespace root$config | select -Property * -ExcludeProperty __* | ft…

Sendmail Batch File

1. Download: 2. Place it in C:\Windows\System32   sendmail.bat --------------------------- senditquiet.exe -s smtp.gmail.com -port 587…

Reset Internet Explorer Settings Script

You can reset Internet Explorer settings to return them to the state they were in when…

GPO Logon Banner

Update: this information is outdated. Use this link for the current method of creating Logon…

Dump Folder Archival Script

Requirements:- Zip any .BAK files that are over 7 days- Delete any zip files that…

Servers Reboot Script

rem method 1: machines that are part of the domainsc \\DOMINO01 stop "Lotus Domino Server…

Recover Windows CD Key

Set WshShell = CreateObject("WScript.Shell")MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))Function ConvertToKey(Key)Const KeyOffset = 52i = 28Chars = "BCDFGHJKMPQRTVWXY2346789"DoCur =…

RDP Gateway with MFA

Step 1: Install RDS Gateway   Prerequisites: 1. Enable Power Shell Remoting  2. SSL Certs…

Repair VSS in Windows 2008

net stop “System Event Notification Service”net stop “Background Intelligent Transfer Service”net stop “COM+ Event System”net…