Query Domain OU and Identify Physical/Virtual Servers

This Powershell script can help identify whether servers in Active Directory are virtual or physical. Create a new Powershell script file named Get-Physical.ps1 with below contents. $serverList = Read-Host -Prompt "Specify OU Distinguished name: (eg. OU=Normal Services - 2008 Servers,OU=Servers,DC=CONTOSO,DC=LOCAL"; #Generates servers.txt file from above input query, searching and generating list of servers within OU. … Continue reading Query Domain OU and Identify Physical/Virtual Servers

Advertisement

Identify failed logon desktop or device

Enable verbose user account logging in order to determine where failed authentication attempts are originating from. Log into primary domain controller. Enable verbose netlogon logs using command nltest /dbflag:0x2080ffff This will enable us to pinpoint which device these failure authentications are originating from. Log file: %windir%\debug\netlogon.log Once log has been accumulated sufficiently, disable verbose login … Continue reading Identify failed logon desktop or device

Home Folder – Compare folders against current domain users

Here is a PowerShell script which probes network home folders with users against the domain. Helpful in order to determine which home folders no longer reference current user accounts and which can safely be removed/archived. $folders = gci "\\Domain.Local\DFS\Users" #This is the root path containing home folders. foreach ($folder in $folders)   {     $username1 … Continue reading Home Folder – Compare folders against current domain users

Windows Server 2012 – Get Folder Size Statistics

Here is a PowerShell function helpful in populating statistics of sub-folder sizes. Create a PS1 file named Get-FolderSize.ps1 with the following contents: Function Get-FolderSize {  BEGIN{$fso = New-Object -comobject Scripting.FileSystemObject}  PROCESS     {     $path = $input.fullname     $folder = $fso.GetFolder($path)     $size = $folder.size     [PSCustomObject]@{‘Name’ = $path;’Size’ = ($size / 1gb) }     } … Continue reading Windows Server 2012 – Get Folder Size Statistics

Exchange 2013 – Get Mailbox Size Statistics

Here is an Exchange Shell script which is helpful in determining mailbox sizes. Queries all user objects within an OU so it is nifty for producing statistics, especially for disabled users. $mailboxes =  Get-mailbox –OrganizationalUnit “domain.local/CompanyName/Disabled Users” foreach ($mailbox in $mailboxes) {     $name = $mailbox.Name     Get-MailboxStatistics $name | Sort -Property TotalItemSize | Select-Object … Continue reading Exchange 2013 – Get Mailbox Size Statistics

Home Folder – Archiving Disabled Users

Here is aPowerShell script to archive all users within an organisational unit (Disabled Users) to a network path. Prerequisite is to grant your Administrator account with ownership/full control permissions to home folders in question prior move. If this condition is not met, then original home folders will remain with remnant data which was inaccessible. $users … Continue reading Home Folder – Archiving Disabled Users

Exchange 2013 – Archiving Disabled Users

Here is an Exchange Shell script to archive all users within an organisational unit (Disabled Users) to a network path. Prerequisite is to grant built-in security group Exchange Trusted Subsystem with modify access to network path. $mailboxes =  Get-mailbox –OrganizationalUnit “DOMAIN.LOCAL/CompanyName/Disabled Users” foreach ($mailbox in $mailboxes) {     $name = $mailbox.Name     if(!(Test-Path "\\[FILESERVER]\Archive$\$name\")) { … Continue reading Exchange 2013 – Archiving Disabled Users