Posts

Showing posts from 2020

Invoke-RestMethod vs Invoke-WebRequest example

 Sometimes I look at old code and think 'Why did I do that? Why not xxxxxx'. Lately that was when looking at Invoke-WebRequest and Invoke-RestMethod. I use both of these in the Service Health scripts when retrieving the access token for accessing the office 365 service health, messages etc. So the quick answer is, Invoke-WebRequest returns the status (ie 200 OK, 404 not found) while Invoke-RestMethod returns the content that Invoke-WebRequest does, and converts it to json (depending on API) So for example Invoke-RestMethod -Uri https://icanhazdadjoke.com -Headers @{accept="application/json"} | Select-Object -ExpandProperty joke returns a single line of the joke Invoke-WebRequest -Uri https://icanhazdadjoke.com -Headers @{accept="application/json"} | Select-Object -ExpandProperty content | ConvertFrom-Json | Select-Object -ExpandProperty joke The above command does the same, after expanding the content and converting.

Missing Teams graphics: it could be cache or it could be......

Image
 A recent case of intermittent DNS responses caused a little head scratching recently. Masking the issue was a few office 365 outages. In the end it was identified as an issue with a DNS server returning only IPv6 addresses. Not useful on an IPv4 network. PowerShell to the rescue and resolve-dnsname checking every few minutes and creating log files. A separate script hoovers these up and displays them nicely formatted in HTML for wider consumption. Simple but handy if needed. https://github.com/JonathanChristie-BHIT/DNSChecker Using a mixture of internal and external DNS servers to check a few entries PowerShell snippet: [array]$DNSServers = @(     ('192.168.0.1', 'Internal'),     ('8.8.4.4', 'Google A'),     ('8.8.8.8', 'Google B'),     ('1.1.1.1', 'Cloudflare A'),     ('1.0.0.1', 'Cloudflare B'),     ('208.67.222.222', 'OpenDNS A'),     ('208.67.220.220', 'OpenDNS B') ) [ar...

KMS Host - Event log search using powershell

With current situation regarding COVID, many companies have users with work laptops happily(?) working remotely. If devices rely on KMS for activation, many devices might suddenly be prompting users if they have not been able to check in for a while. You can search you KMS logs for activations (or not). You may be lucky and be able to go back pre-lockdown and pull out devices that initially connected but have'nt been seen since. In the KMS host, you can pull out the event logs and export to CSV. In this case we're looking at the Key Management Service logs and the ReplacementStrings result. item 7 of that array gives us the licence status of the machine as it attempts to activate. This can be one of: 0 - Unlicensed 1 - Licensed (Activated) 2 - OOB grace 3 - OOT grace, 4 - NonGenuineGrace 5 – Notifications 6 – Extended Grace A quick export into CSV and its ready to be sliced and diced in excel $now=get-date $startdate=$now.adddays(-210) $evtLog = get-eventlog -Comput...

Client side diagnostics - and Office 365 Portal Workload replaced

Something that I've been meaning to add for a while now has been client side diagnostics. So I've finally managed to find some time and add these in. These are based on the URLs published by Microsoft and updated on a regular basis. The server side script generates a txt file which is actaully another powershell script which you copy/paste locally, save as a .ps1 file (not all web servers can deliver .ps1 files ie IIS with default configuration) It takes a few minutes (particularly if there are timeouts)  - improvements (including progress bar!) coming next. Also, I've noticed this morning that the 'Office 365 Portal' feature has been replaced with 'Microsoft 365 suite'. The rebranding continues! Download scripts from https://github.com/JonathanChristie-BHIT/Office365-Info

Service Health Updates........Update

Image
So, whats new and exciting? Just a little. Incidents Incidents tab now shows open incidents too. IPs and URLs The email alert has been re-jigged to show the latest updates instead of just an alert that there were changes. Minor tweaks and adjustments Miscellaneous Diagnostics can be enabled/disabled in the config file PAC file creation can be enabled/disabled in the config file Dashboard now checks for the .css file as well as ok/warning/error jpgs and copies them if not found (ie a new install) You can find the updated package on github  https://github.com/JonathanChristie-BHIT/Office365-Info