Day: September 4, 2020

PowerShell: Get OU of a User & Get All Users In an OU

function getUserOu($username){ if(!(get-module activedirectory -ea SilentlyContinue)){ $osType=switch ((Get-CimInstance -ClassName Win32_OperatingSystem).ProductType){ 1 {'client'} 2 {'domaincontroller'} 3…

PowerShell: Test Domain Username & Password Credential

Version 2: function testCredential($username,$password){ # Get current domain using logged-on user's credentials $isDomainJoined=$env:USERDOMAIN -ne $env:COMPUTERNAME…

How to Add Domain Admins to SQL Server

Step 1: Right-click Start > Search > type in 'ssms.exe' > right-click Microsoft SQL Server…

SQL: Creating a Storage Report of Databases Residing within Server

Method 1: -- Get sizes of all databases from system (not real-time) WITH fs AS…