Here is a script to get tasks (historic tasks not just current) and also the events associated with that task.This is very handy for auditing or troubleshooting. The task collection part of the script I found on LucD blog at https://www.lucd.info/tag/get-task/ Basically this will get all tasks and events for a specific time frame. It…
Category: PowerShell
Simple ACL functions
Here is a set of simple functions for basic management of directory permissions or Access Control Lists. when setting up file shares I tend to it in very few unique steps. Break inheritance while keeping ACLs, Add/Remove/Modify users or groups. So I have 4 powershell functions to simply complete these tasks. Put those functions at…
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….
Menu Function
One (very boring) locked in Bank Holiday weekend, with my right hand in plaster I decided to write a function/s I had been meaning to write for a long time. A “simple” on screen menu. You give the function an array and it will display it and let you pick a row/element and return that…
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, Basic Loops
In this PowerShell tutorial I will detail the For loop, ForEach-Object loop, and the Do loops (Do-While and Do-Until). These loops are lited below for quick reference (I use the standad for loop so infrequantly I have to normaly look it up) then I will go in to more detail on each one. 1, The…
Powershell tutorial, Modules
In this post I will explain using and managing Powershell modules. A Powershell module is simply a piece of code which adds more commands to the Powershell compiler to expand its cross platform functionality. For example: Need to get info out of VMWare? No problem, there are several modules for that. Need to get SNMP…
PowerShell Tutorial, what version am I running?
Knowing the version of Powershell you are running is very important as some commands/syntax will only work on new versions and vice-versa. To display the Powershell version, issue one of the following commands: Get-Host | Select Version $PSVersionTable Versions of Powershell are as follows. V1 and V2 were released in 2006 for XP SP2, Vista…
PowerCli One-liners
Here is a page of One liners I have written/collected over the years. I will add more over time. # Lists eachs hosts VMKernal interfaces with there PortGroup, IP and MTU. # Set all NetApp LUNs to RoundRobin # get all hosts NTP servers. # Get current and configured scratch location. # get PortGroup, IP and…
Getting tasks from VMWare
If you use the flash client to administer a vCenter server then you will know how bad it is at updating the task list. Here is a handy powershell example of getting a list of running tasks. Only need to see running tasks? Values for -Status can be: Error, Queued, Running, and Success That is…