Visitors

HOW TO: Migrate FSMO Roles in Windows Server 2016 Active Directory using Powershell

Log in to Windows Server 2016 as a member of Enterprise Administrators group; Run Powershell as Administrator; Type netdom query fsmo to get a list of the FSMO roles and their current owners; PS C:\Windows\system32> netdom query fsmo Schema master cs-core-adc-01.vstrong.info Domain naming master cs-core-adc-01.vstrong.info PDC cs-core-adc-01.vstrong.info RID pool manager cs-core-adc-01.vstrong.info Infrastructure master cs-core-adc-01.vstrong.info […]

PowerShell: Create new Active Directory users

In my previous “PowerShell: Create new Active Directory groups, change group membership” blog post I published a PowerShell script that automates create Active Directory group creation. Today I needed to create multiple test user accounts and, and there were 12 account created already, the TestUser account number should start from 13. All New-ADUser cmdlet parameters […]

PowerShell: Create new Active Directory groups, change group membership

The following script helps you to:

Import Active Directory groups and their descriptions from a CSV file; Create Active Directory Groups and add Description If the Group is flagged (Yes or No), it will be added to another group (e.g. User groups –> Application provisioning group)

Excel view:

AD Group Name AD Group Description Add […]

PowerCLI: Average CPU, Memory, Network and Disk usage

This simple PowerShell/PowerCLI script calculates the average CPU, Memory, Network and Disk usage for powered on virtual machines over the last 30 days, 5 minutes interval.

Amend ‘AddDays(-N)‘ and ‘-IntervalMins 5‘ if needed.

Get-VM | Where {$_.PowerState -eq "PoweredOn"} | Select Name, Host, NumCpu, MemoryMB, ` @{N="CPU Usage (Average), Mhz" ; E={[Math]::Round((($_ | Get-Stat -Stat […]

Configure DHCP reservation with Powershell

Quick Powershell script to add DHCP reservation for a VM on multiple DHCP servers:

Please refer to DHCP Server Cmdlets in Windows PowerShell for more details.

$DHCPservers = ‘DHCP001’, ‘DHCP002’ $Scope = ‘10.80.24.0’ $IPaddress = ‘10.80.24.12’ $Server = ‘SQL001’ $Domain = ‘internal.vStrong.info’ $VM = Get-VM $Server # $VM.NetworkAdapters.MacAddress returns MAC address in semicolon separated 00:50:56:00:00:00 […]

Cisco UCS: Add/Remove VLAN on vNIC using Powershell

Recently I worked in the environment where we needed to modify multiple UCS Service Profiles, adding and removing VLANs to/from vNICs.

If you are using vNIC templates – it is just a few clicks and you are done. But what if you don’t? What if you have 20 Service Profiles and each has 10 vNics […]

VMware PowerCLI script to list Thin provisioned virtual disks (VMDK)

One of my clients was concerned about the number of virtual machines that were built with Thin provisioned disks. Before they go with the project to inflate all Thin provisioned disks (or migrate to Thick Provisioned Lazy Zeroed) they needed to know how much additional storage they would need.

PowerCLI to the rescue!

Yes, you […]

Exporting Virtual Machine information with PowerCLI

Just a quick script to export virtual machine inventory:

$report = @() foreach ($DC in Get-Datacenter -Name MyDC){ # Specify Datacenter name if needed foreach ($Cluster in Get-Cluster -Location $DC ){ # Specify Cluster name if needed foreach ($VM in Get-VM -Location $Cluster ){ $row = "" | select DC, Cluster, ResourcePool, VMPath, VMhost, PowerState, […]

VMware PowerCLI script to query Virtual Machine events

I have been asked to write a script to find out who created a particular VM or get a list of VMs that were built in the last N days…

Again, we need to go through the vCenter database and search for a particular event type or name. Cmdlet that is going to help us […]

HOW TO: Identify VMFS Datastore on Perennially Reserved LUN

We all well familiar with the problem with Raw Device Mapped (RDM) LUNs that are used by VMs running Microsoft Clusters Service.

VMware KB: 1016106

ESXi 5.0 uses a technique to determine if Raw Device Mapped (RDM) LUNs are used for MSCS cluster devices, by introducing a configuration flag to mark each device as “perennially […]