Forcing Azure AD Connect Sync
Aug29

Forcing Azure AD Connect Sync

KB ID 0001590 Problem If you are using Azure AD Connect, (AAD Connect) to sync your on-premise Active Directory with Azure AD (i.e. for Office 365), then there may be times when you need to manually ‘force a replication’ because by default it’s going to take 30 minutes between each normal ‘delta replication’ Solution If you are directly on the server that’s running Azure AD connect, then use the...

Read More
PowerShell: Add All Members of an OU to a Security Group
Aug28

PowerShell: Add All Members of an OU to a Security Group

KB ID 0001589 Problem I’ve written in the past about ‘Bulk Adding Users from CSV files, into Groups’. But what if you want to add ALL users in a particular OU into a security group? Solution The syntax is; Get-ADUser -SearchBase ‘OU=Source-OU,OU=PNL,DC=pnl,DC=com’ -Filter * | ForEach-Object {Add-ADGroupMember -Identity ‘SG-Test-Group’ -Members $_ } Here I’ve got 20 users that need adding to a group, in this...

Read More
PowerCLI: vMotion Multiple VMs
Aug23

PowerCLI: vMotion Multiple VMs

KB ID 0001585 Problem vMotioning one VM is pretty simple to do; Get-VM VM1 | Move-VM -Destination (Get-VMHost ESX-02.pnl.com) And moving ALL the VMs on one host, to another is pretty straight forward also; Get-VMHost ESX-01.pnl.com | Get-VM | Move-VM -Destination (Get-VMHost ESX-02.pnl.com) But what if you have a list of VMs you want to move, and you are too lazy, (sorry too skilled), do do them manually or one at a time? Solution...

Read More
PowerShell Exported CSV is Garbled?
May22

PowerShell Exported CSV is Garbled?

KB ID 0001557 Problem I was exporting a list of enabled Active Directory users to a CSV file for some documentation, the finished article was not what I was expecting; Contents; Microsoft.PowerShell.Commands.Internal.Format.FormatStartData ClassId2e4f51ef21dd47e99d3c952918aff9cd,  pageHeaderEntry pageFooterEntry autosizeInfo shapeInfo groupingEntry 033ecb2bc07a4d43b5ef94ed5a35d280...

Read More
VMware: Export a VM to OVA With PowerCLI
Jan21

VMware: Export a VM to OVA With PowerCLI

KB ID 0001507 Problem It’s pretty easy to create an OVA/OVF from the vCenter Web console, but what about from Powershell / PowerCLI? Below I run though converting a 2008 x32 Windows server to OVA. Solution I’ll leave the web console in the background so you can see whats happening. From PowerCLI the first task is to connect to the vCenter. Connect-VIServer {vCenter-FQDN} Supply a username and password. Now remove any...

Read More
PowerShell: Bulk Add/Remove Users From Groups
Oct15

PowerShell: Bulk Add/Remove Users From Groups

KB ID 0001475 Problem I had to do this a few weeks ago, so I documented it. I had a list of usernames in a CSV file and I needed to bulk-add them to a security group. Bulk Add Group Users Solution Firstly you will need the usernames (sAMAccountNames) in .csv format like so,  (Note: As a header Im using User-Name.) I’ve saved the file to C:\Temp on my server. Execute the following commands; Import-Module ActiveDirectory ...

Read More