Home

Get Users AD Account from EMail Address

Posted on August 14, 2014
Category: Exchange
This script will take a list of email address and return the users AD info, I have enabled View Entire Forest, in case your are in a multi domain environment. [code language=”powershell”] Import-Module ActiveDirectory Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin $AdminSessionADSettings.ViewEntireForest = $true Get-Content C:\EmailList.txt | Get-Mailbox | FT SamAccountName,Alias,PrimarySMTP [/code] byRead More

List all Sites and Subnets in AD

Posted on August 14, 2014
Category: Windows Server
This script will export a list of all Site and Subnets and the domain controllers in them. [code language=”powershell”] [cmdletbinding()] param() $Sites = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites $obj = @() foreach ($Site in $Sites) { $obj += New-Object -Type PSObject -Property ( @{ “SiteName” = $site.Name “SubNets” = $site.Subnets -Join “;” “Servers” = $Site.Servers -Join “;” } ) } $obj | Export-Csv ‘C:\sites.csv’ -NoType [/code] byRead More
When migrating users to O365, you may need to set a group of users or specific users Item Retention and Deleted Item retention policies. If you have a list of users who need specific settings you can run the following command against the list to only apply the desired settings to those users. You will need to connect to O365 to run these scripts for O365 Users. ### This script will list all users in a csv file who haveRead More
When you are migrating users to O365 there may be a requirement to run post migration scripts, for setting the users location, and enabling licenses. You may be performing the migrations using a csv, and users may be in different locations, so you cannot just run the commands against the entire organisation. The csv contains a list of User UPNs. ### First we must find out our License SKU to apply [code language=”powershell”] Connect-MsolService Get-MsolAccountSku [/code] ### Set a usersRead More

PowerCLI Get ESXi Host and Version

Posted on August 4, 2014
Category: vSphere
This script will connect to a vCenter server and list all hosts it can see and the version of ESXi running on the host. I have also exported this to a csv [code language=”powershell”] Add-PSSnapinVMware.VimAutomation.Core Connect-VIServer-Server vSphereServerName Get-VMHost | Select Name,Version,@{N=”vCenter”;E={$_.ExtensionData.CLient.ServiceUrl.Split(‘/’)[2]}} |ft name,version | Out-File FileLocation [/code] byRead More