How to use AWS PowerShell cmdlets with Filter

I personally can’t imagine supporting a big infrastructure without introducing automation and to automate something you have to use command line. If you are more into Windows and started working on AWS for your clients, then I assume that you would love to start managing AWS using AWS PowerShell Module like I do. AWS Console is really good and informative but when it comes to bulk activity I am always depending on PowerShell.

There is a very good documentation created by Amazon for AWS PowerShell, you will get the basic help for all the available PowerShell cmdlet from here. It will be very much helpful for you to start working on AWS PowerShell, but unfortunately when it comes to using filter available for those cmdlet, you won’t be able to find any good example. Using filter on a AWS cmdlet will be a smart move and it also reduce the total execution time. Initially I also struggled to get this working due to lack of examples, but later I figured it out, and now I always try to utilize filter and I am writing this to you help you understand how easily we could use this.

Some of the sample, hope this will help you.

Extract the list of the snapshots under your ownership.

This script, I am using filter to identify the snapshots mapping with instance

Continue reading

Cleanup disabled users from AD Group/s

Cleanup disabled accounts from groups is one of the most boring job, and also take lots of time. Manually it’s almost impossible to maintain. Recently I had a request to perform such task for many groups, so, I wrote a script to do it automatically on behalf of me. I am now sharing this script, hoping this might help you as well.

This script will do following task automatically.

  • Get the members of a group.
  • Identify only users.
  • Identify disabled users.
  • Check every disabled users group memberships.
  • Remove the disabled users from that group.
  • Generate a report with status (success / failure).
  • Keep the report on your desktop.

Multi-Thread Super-Fast Software Inventory Scan using WSMan (PowerShell Remoting)

Recently I was asked to pull the software inventory report from multiple severs hosted in Azure, but unfortunately pulling data from WMI not allowed, only PS Remoting was enabled, so I made some changes on my previous script and used Invoke-command to pull the date for all the servers. It was easy and the most effective way to extract that report and only took 5 minute to get the data. 🙂

Here is the modified script, I hope you might find this useful

Continue reading