Useful AWS powershell profile prompt

With having a number of AWS accounts to manage you might find yourself lost as to what account and or credentials you are currently using.

The below function when added to you profile.ps1 will modify your powershell prompt with the current shell AWS credentials and region you are using and add a bit of color to it to help you see it.

So when executing AWS commands you “shouldn’t” get lost as to what account you’re in.


It will also remove it if you open up a normal PowerShell window and don’t have any AWS Credentials loaded in the session.


function prompt 

 $prompt = ""
 $prompt1 = ""
 $prompt2 = "PS "
 if ($StoredAWSCredentials -ne $null)
    $prompt1 += "$StoredAWSCredentials"
 if ($StoredAWSRegion -ne $null) 
    $prompt1 += "@"
    $prompt1 += "$StoredAWSRegion"
    $prompt1 += " "
 $prompt += $pwd.ProviderPath
 $prompt += ">"

 Write-Host $prompt2 -nonewline -foregroundcolor Green
 Write-Host $prompt1 -nonewline -foregroundcolor Yellow
 Write-Host $prompt -nonewline -foregroundcolor Green
 Write-Output " "




SCOM Reporting Forecasting/trending Powershell Report

SCOM Reporting Forecasting/trending powershell report solution


The “issue”:

The previous monitoring tool sets reporting tool had the ability to generate forecasting reports but unfortunately SCOM does not have the capability out of the box to produce these reports or perform this analysis.


I investigated other solutions and did find a couple (one was at a significant cost while another only provided graphics and not statistics/report). These didn’t seem to fit the bill so I then decided to develop my own.


So i created a Powershell script that gets the data, analyzes it and produces HTML reports. The breakdown you can see below is on how my script is structured and if you would like to create the code for yourself (best way to learn).

  • get list of unix servers from resource pool specified  (we use different resource pools for different gateways but you can modify this into list of servers from a group)
  • gets list of windows servers from gateway server (we use gateway servers but you can modify this into list of servers from a group)
  • run SQL query to extract performance data form the data warehouse (for the list of servers specified above and store the results)
  • analyze the each performance counter/instance and workout the average and projections (The store these results for reporting)
  • clean the data table (remove negative numbers and replace with 0)
  • generate html reports based on the processed data
    • 0-45 days to upgrade (report lists CPU/Memory/Disks that will run out of space in the next 45 days or have already run out of space)
    • 46-200 days to upgrade (report lists CPU/Memory/Disks that will run out of space in the next 46-200 days or have already run out of space)
    • Full table of results for reference

The report is then scheduled on a management server and is only run once per month.

Note: It takes 6 hours to process as this is a synchronous script and depends on the number of servers or objects that need to be analysed. (some unix servers have upwards of 30 file systems which causes the script to take some time.

I originally had this all in one script but to speed up processing I split it into 2 (Windows and Unix).

I also investigated power shell workflows but it has it limitations as it wont use some of the power shell commands I had in my script.


Download Capacity Report Script Here

Edit: I have moved this to github:

Please contact me if you have any questions.