Remove Spaces from Powershell Output
This one is great! If you have an output file with lots of trailing spaces, try the cmdlet below. (gc c:\scripts\test.txt) -replace ‘ {2,}’,” | sc c:\scripts\test.txt GC (Get-Content) reads the file....
View ArticleAdd users to a distribution group from a .txt file
get-content D:\evscripts\evmbxusers.txt | Add-DistributionGroupMember “tap Enterprise Vault Users”
View ArticleFind empty AD security groups using Powershell
(I am using Quest ActiveRoles Management Shell) Get-QADGroup -GroupType Security -Empty $true If you want to count the number of results: Get-QADGroup -GroupType Security -Empty $true |measure-object
View ArticleNew Version of Quest ActiveRoles Management Shell Available! (1.5.1)
http://www.quest.com/powershell/activeroles-server.aspx
View ArticleCount Results Of a cmdlet
In this simple example I want to count the number of users in the “Terminated Users” OU. I can do this in 2 parts: 1. Create a variable called “$terminated” in which to store the output. $terminated =...
View ArticleArticle 4
This script will remove any group members of “g_adobe_users” that are located in the OU called “terminated”: Get-QADUser -MemberOf “g_adobe_users” | where {$_.parentcontainerdn -match...
View ArticleHow to Add Quest Module to Native Powershell
http://desktopfeedbag.com/2008/08/02/how-to-add-quest-ad-tools-to-your-native-powershell/
View ArticleReview UPN or User Principal Names
Prior to activating (or on-boarding) users into Office 365, you need to make sure that your UPN’s are correct in AD (if you are using DirSync). I used this command to export account details for all...
View ArticleCompare Contents of 2 Files
This is a great little script. If you have 2 files, each with a list of items (for example server names), this script will compare both files and tell you: Which items exist in both lists (=). Which...
View ArticleFind Duplicate Mailboxes
Here’s how you find any duplicate mailboxes in an Exchange environment: $mailboxes=Get-Mailbox -resultsize unlimited $mailboxes| group name |sort count -descending All duplicate mailboxes will appear...
View ArticleExport List of AD Sites and Subnets
This is a cute little powershell script that will export a list of all AD Site Names and associated Subnets. It will create multiple lines where multiple Subnets exist… ADSites.ps1 [cmdletbinding()]...
View Article
More Pages to Explore .....