I’ve been playing around with Invoke-WebRequest in PowerShell to try and push dashboard content onto an email.
I want to send a snapshot of service status at 9am every morning, and rather than just sending them a link, I would like to put the dashboard content into the body of an email.
Has anyone done anything similar…?
I can invoke the Powershell and send the email from Orchestrator, I just need to capture the html, and not having much luck.
Having looked at it myself it appears that the web request does something fancy with a script to get a screen size that then makes another request to get the image (with the current unix timestamp in miliseconds Powershell: [DateTimeOffset]::Now.ToUnixTimeMilliseconds()).
However when attempting to call this separately I get a failure to pass security check. You might be able to get around this by taking a screenshot the screenshot! I\'ve used PowerWebshot in the past to automate the checking of webpages for defacement. You\'d need to edit the function to add in a delay to compensate for the loading of the dashboard but assuming that this doesn\'t fail the check in the same way you could use the output of that.
Thanks for the pointer. I will have a look at PowerWebshot. Using the cached image was kind of where I was headed. Good to know I’m not headed down the wrong direction. Thanks again.