This is a part of a script I have been using for about 2 years to pull basic data out of the Zerto analytic portal. I have really only just scratched the surface of what I can get. When I first wrote this all I needed was the number of green/yellow/red VPGs but there is…
Tag: tutorial
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…
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…
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…
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…