#DSQuery dsquery user -name "*" -limit 0 | dsget user -samid -hmdir -hmdrv -profile >c:\temp\usersV2.txt #PowerShell # More flexibility # Includes the state of the computer account (Enable or…
How To Access A SQL Server 2008 Databases WITHOUT SA (SysAdmin) Credentials
Challenge : How to make a backup of a SQL 2008 database without knowing any working credentials. Log on to the Windows 2008 R2 server running SQL Server 2008 as…
Remove Directory Batch Script
#Remove directory in a batch file # rmdir /S /Q "C:\test\"
Robocopy Mirror Files and Folders
Map network drives to the correct locations Run CMD as Administrator Mirror file & directories and output detail to text file robocopy E:\..... z:\.... /MIR /S >c:\temp\detail.txt
List all users in the domain and email addresses
import-module activedirectory #List all users in the domain # Display Name and Email Address get-aduser -Filter * -SearchBase "dc=Test,dc=com" -Properties Displayname,emailaddress | select displayname ,emailaddress | Export-Csv C:\temp\users_and_email.csv
Troubleshooting Windows Updates and WSUS
Troubleshooting Windows Updates #Windows 10 #Windows 2016 Windows Update Log PowerShell command to check the Windows Update log • Get-WindowsUpdateLog Check Registry Keys Run command prompt as adminitrator and…
Get a list of active users which have logged on to the domain in the last 7 days
# Get a list of users which have logged on to the domain in the last 7 days $Date = (Get-Date).AddDays(-7) Get-ADUser -Filter {LastLogonDate -gt $Date} | Select distinguishedName
PowerShell Script to find all AD users who have the “cannot change password” box checked in a specific OU
# script to find all AD users who have the "cannot change password" box checked in a specific OU # Windows Server 2016 # Powershell Get-ADUser -Filter * -Properties CannotChangePassword…
Robocopy. Copy Move Files Older or Newer than X number of days
Script options Move only files under 60days old Move files older than 60days Move files back Move files older than 182 is number of days (6 months roughly) Move only…
Automating File-Based Backups of vCenter Server…
Automating File-Based Backups of vCenter Server Appliance Automating File-Based Backups of vCenter Server... Did you know the vCenter Server Appliance (VCSA) has file-based backup options? This ability was actually released…