Enable multiple Active Directory users for Lync/Skype for Business through management shell


User management for any enterprise business class application is a key. This kind of task comes under administration but some time implementation team also perform these activities. This post provides a little help to the implementation consultant or UC administrator.  To enable group of users for Lync/Skype for Business is very common but through control…

Get group membership of AD user


To get single user membership: Get-ADPrincipalGroupMembership -Identity “username” | select name | ft To get multiple user membership: Import-Csv “C:\users.csv” | ForEach { $group = (Get-ADPrincipalGroupMembership -Identity $_.username).Name; New-Object -type PSObject @{$_.username = group}} | Out-File -FilePath “c:\result.csv” #users.csv is a file for list of users. Username user1 user2 user3

Remove all secondary email addresses through powershell script


$Input = Get-Content C:\users.txt | Get-Mailbox $Input | foreach { write-host “$($_.Name) —- $($_.EmailAddresses.Count)” for ($i = $_.EmailAddresses.Count ;$i -ge 0; $i — ) { $_.EmailAddresses[$i].ProxyAddressString   if ($_.EmailAddresses[$i].IsPrimaryAddress  -eq $false ) { $_.EmailAddresses.RemoveAt($i) }  }   set-mailbox  $_.Identity -EmailAddresses $_.EmailAdresses }

Create Mailboxes with new AD account through Powershell


Script:$Password=Read-Host “Enter Password” -AsSecureStringImport-CSV “C:\users.csv” | ForEach {New-Mailbox -Alias $_.alias -Name $_.name -userPrincipalName $_.UPN -Database “Mailbox Database 1” -OrganizationalUnit EmailUsers -Password $Password |Set-mailbox -EmailAddressPolicyEnabled $false -PrimarySmtpAddress $_.EmailAddress} CSV File Format: Alias Name UPN EmailAddress Alias: Alias name for the user(like:ajay.kakkar)Name: Full user name(like: Ajay Kakkar)UPN: User logon name(like: ajayk@contoso.com)Email Address: User email address(like: ajaykakkar@contoso.com) Note:…

Disk space report of remote computer/servers through powershell


Script:Param ( $computers = (Get-Content  “C:\Scripts\Computers.txt”) ) $Title=”Hard Drive Report to HTML” #embed a stylesheet in the html header $head = @” <mce:style><!– mce:0 –></mce:style><style _mce_bogus=”1″><!– mce:0 –></style> <Title>$Title</Title> <br> “@  #define an array for html fragments $fragments=@() #get the drive data $data=Get-WmiObject -Class Win32_logicaldisk -filter “drivetype=3” -computer $computers #group data by computername $groups=$Data |…

Enable Mailbox through Powershell for existing AD users


Script:Import-CSV “C:\text.csv” | ForEach {Enable-Mailbox -Identity $_.UPN -Database “Mailbox Database 1” -Alias $_.alias | Set-Mailbox -EmailAddressPolicyEnabled $false -PrimarySmtpAddress $_.EmailAddress} CSV File Format:     Alias: Alias name for the user(like:ajayk)UPN: User logon name (like: ajayk@contoso.com)Email Address: User email address(like: ajaykakkar@contoso.com) Note: Alias and Email Address could be same or different as per your requirement.

AD DS Deployment through Windows Powershell – Windows Server 2012


## Windows PowerShell script for AD DS Deployment# Import-Module ADDSDeploymentInstall-ADDSForest `-CreateDnsDelegation:$false `-DatabasePath “C:\Windows\NTDS” `-DomainMode “Win2012” `-DomainName “WIN2K12.COM” `-DomainNetbiosName “WIN2K12” `-ForestMode “Win2012” `-InstallDns:$true `-LogPath “C:\Windows\NTDS” `-NoRebootOnCompletion:$false `-SysvolPath “C:\Windows\SYSVOL” `-Force:$true Note: This is a script which can be run for AD DS configuration to promote the first server as a DC in new forest. Please install prerequisite…