Powershell: Getting monitor info

Today I got a request from a colleague of mine that was doing inventory: What are the make, model, serial number and purchase date of your monitors? Seeing as this wasn鈥檛 something I had readily in my head I had to figure it out, but being the automation enthusiast that I am, I refused to bend over my monitors and snap a photo of it all. I wanted to find it a cooler way, the powershell way 馃檪...

August 26, 2019 路 nerenther

PowerCLI: Creating custom SATP rule for HPE 3PAR

A while back we migrated from our old EMC VNX to a new HPE 3PAR array. It all went fine but what kinda slipped our mind is that HPE鈥檚 best practice is to create a custom SATP rule that uses RoudRobin as path selection policy and a IOPS limit to 1 in stead of the default 1000. The steps are documented in the聽HPE 3PAR VMware ESX/ESXi Implementation Guide, but they only show you how to do it through the esx cli....

August 8, 2017 路 nerenther

Powershell and the HPE 3PAR REST API

Lately, I鈥檝e had the pleasure of using Powershell to automate some of the basic tasks we do on our HPE 3PAR systems: creating volumes, adding them to volume sets, exporting them and so on. Since my experience with REST APIs was rather limited it was quite daunting at first but once you get the hang of how REST works and the Invoke-RestMethod cmdlet it鈥檚 really not that bad. Disclaimer: The examples below will vary somewhat in how I do certain things, simply because I had to learn all this from scratch....

June 15, 2017 路 nerenther

Powershell: Creating strong passwords

A tweet from @JanEgilRing caught my eye this morning, it聽was showing聽how you can use powershell to create passwords. The link in the tweet pointed here:聽http://powershell.com/cs/blogs/tips/archive/2016/05/23/one-liner-random-password-generator.aspx Seeing that line and realizing how simple it was, it got me thinking on聽how I could implement this in my scripts. The only issue I saw with that one-liner was that the passwords it creates do not necessarily comply聽with high complexity rules....

May 26, 2016 路 nerenther

UCSD: Mapping EMC VNX LUNs to an ESXi cluster

I have been struggling for quite some time with mapping luns from our vnx 5600 to entire clusters in our vCenter. We used to utilize a custom workflow a consultant wrote for us, but that workflow got borked after an update to UCS Director nearly a year ago. Revisiting the issue i found this example from Cisco:聽https://communities.cisco.com/docs/DOC-57382 That example seems to work for other people but in our case the custom task in it never gave the correct output, so I had to look for a way around it....

October 15, 2015 路 nerenther

UCSD: Grabbing a string returned from a Powershell task

My last post described how to get around some issues with using Powershell tasks in workflows. While that post surely enables you to uilize powershell to do stuff for you, what about if you want Powershell to grab stuff for you and return them in a usable matter? This time I鈥檓 going to show you how you can return a string from Powershell and use it further down in the workflow....

October 13, 2015 路 nerenther

UCSD: Passing multiple arguments to start-job while using the Cisco PowerShell Agent

While the聽Cisco PowerShell Agent (PSA) that can be used in UCS Director isn鈥檛 exactly perfect, it can still be put to good use. As long as you now how to use it properly 馃槈 The major issue with using the PSA is that it doesn鈥檛 stick around to see if the commands/script was successful or not. As long as it delivered the commands successfully, it鈥檚 happy and your workflow will continue to the next step....

November 12, 2014 路 nerenther

PowerCLI: Function for listing snapshots

My very first PowerCLI related post was about this same topic: listing snapshot info using PowerCLI. In my original post (which you can see here) I only wrote a pretty simple one-liner. Which was kind of okay, but it was missing one crucial thing: who took the snapshot? Why vmware hasn鈥檛 found a way to include a username in the get-snapshot cmdlet is something I just can鈥檛 understand. There鈥檚 really not much code needed to add this to the output, and there鈥檚 several ways of doing so....

September 17, 2014 路 nerenther

PowerCLI: Evacuating a datastore

In case you ever need to empty out a datastore in you vmware environment, there is a nice little one-liner in PowerCLI for that: Get-VM -Datastore "datastore1" | Move-VM -Datastore (Get-VMHost -Location 'cluster1' | Select-Object -First 1 | Get-Datastore | Where-Object {($_.Name -ne 'datastore1') -and ($_.FreeSpaceGB -gt '500')} |聽Sort-Object FreeSpaceGB -Descending | Select-Object -First 1) Where 鈥渄atastore1鈥 is the datastore you want to empty out and 鈥渃luster1鈥 is the cluster where the datastore is available....

September 11, 2014 路 nerenther

PowerCLI: Listing VMs with ISOs mounted

For almost a year ago, I posted a simple one-liner to list all VMs who has ISOs mounted. You can view that post here:聽http://cloud.kemta.net/2013/10/powershell-vmware-list-all-vms-with-iso-mounted-and-dismount-them/ That post was written before I truly discovered the major advantages of using Get-View instead of Get-VM, Get-VMHost and so on. If used correctly, there鈥檚 a major difference in speed when using Get-View over Get-VM. When writing this post I checked the differences in speed when using the old way that I linked to above and my new function (which I鈥檒l get to in a second or two....

September 9, 2014 路 nerenther