I recently had to run some monitoring commands to gather information while a backup was running. So I used Powershell. I needed to SSH on to the FAS and run the following: So why should I do that when I can get Powershell to do it. Here is a quick bit of Powershell to SSH…
Tag: Powershell
Tutorial, Using Credentials
A common problem I have is that the account that runs a powershell script does not have the required rights on a remote computer to do its job. It could be because the remote “thing” only has local accounts or is a windows computer on a different domain. The old way of getting round this…
Report VM reconfigurations
One this that has always bugged me with vCenter UIs is seeing a reconfigure VM task but not being able to tell what was changed. Some times in an investigation this can be very important. While looking at Event objects one day I discovered an attribute called configchanges on a reconfigured event object. In there…
Tutorial, calculated property
Here is something that I have used for a while but had no idea what it was called. After a bit of googling, apparently its a calculated property. What is a calculated property? A calculated property is changing the name and/or value of an attribute as its copied to a new object or the screen….
Tutorial Functions
Powershell, like just about every other programming/scripting language has functions. These functions can be simple one liners or very complicated, depending on your needs. A very simple function is show below. This function has a name and a code block. It has no input and will only output to the screen. Why should I use…
MultiPing function
This is a function (3 functions) I have been meaning to write for a while. It is a Ping function that will ping more then one target and report what is responding, what is not and the time.To keep the display easy to read, if there is no state change then the last line is…
Powershell tutorial, Jobs part 1
Powershell code runs synchronously. This means that one line is processed at a time until the end of the script is reached. This is fine for most scripts but there will be situations where this type of execution is not ideal. A port scanner for example would take forever if it ran synchronously. When creating…
Powershell tutorial, Jobs part 2
Here is a Ping sweeper script using Powershell jobs to speed things up. The script works (at a high level) like this: I create an array of IP addresses to scan. I loop through each IP If I am running the max number of concurrent jobs, wait for some jobs to finish, add the results…
Find VMs restarted by HA
Administer VMWare long enough and you will eventually lose a host. If you are using HA you may not notice until the phones start ringing some time later. At this point all the VMs are back on line on different hosts. When Problem management/bosses get involved you will normally be asked “what VMs restarted?”here is…
Powershell Dot-Source
Using Dot Sourcing is a quick and easy way of getting functions or data into your Powershell console or script. If you run a Powershell script from a console, all the data in memory is deleted when the script ends (unlike the ISE where it is still in memory).This is because the script is running…