Skip to content

Tag: PowerShell

PowerShell: Get the Office 365 Endpoint Information from Microsoft

A while ago, I published the reworked script to get Office 365 URLs and IP address ranges. Microsoft has built a new fully rest full Webservice to get the same information via JSON instead of XML.
The only drawback of the new service: If you like to use it for a single produce, you need to filter after you have downloaded the information. The product sets are limited.

However, there are a lot of examples in the new script, these examples show you how, where, and what to filter.

Quick and dirty script that removes all older versions of all installed PowerShell Modules.

I use a lot of PowerShell Modules. Some of them are deployed via a Build Server, so I get a lot of test builds! All of them have a new version tag, which is good. And I also use a lot of Modules from the PowerShell Gallery; some of them are updated frequently.

So my Systems ended up with a lot of older versions for several modules.

Manually removal is something I don’t like… So I started to search for something that removes all older versions at once, so my system has just the latest and greatest version of each Module left.

PowerShell Function to get the Office 365 URLs and IP address ranges

Update:
There is a newer Script, that uses the new JSON based service from Microsoft! You should use the newer one instead of this!

I know that there are a few functions and scripts like this available. Honestly, the roots of this function are a bit older.

Now some of the developers at enabling Technology tweaked and extended my old function, and they also quashed out a few bugs!

Upload a file with PowerShell and Invoke-RestMethod

I came across the following challenge: Automate the upload of several build artefacts to the BitBucket cloud service downloads section.
You might ask yourself “why is this a challenge“, and the answer was a little shock for me: “cause it is something that might get very complicated with Windows PowerShell 5“.
I did some test on my Mac and I find it very easy with curl.

curl -X POST "https://MyUsername:[email protected]/2.0/repositories/dummyTeam/myproject/downloads" --form files=@"/home/dev/release\myproject-current.zip"

But curl is not available an my build server. So I tried to get it working with Invoke-RestMethod or Invoke-WebRequest. I ended up very frustrated! Searched around and found a lot of people that seem to have the same problem, but none of the answers seemed to work, at least not for me. Maybe an issue of the BitBucket cloud API, but I think it is more a general issue of Windows PowerShell.

Connect to Office 365 with PowerShell Core from non-Windows

As a Apple Fan boy, I'm happy that PowerShell Core is now available for macOS! Together with Visual Studio Code I'm able to run a lot of things on my Mac without having a virtual Windows machine running.

I was asked: "Do you use the native macOS PowerShell to connect to Office 365".
The short answer is: "Not really"!

And at the moment (December 2017) there are two main reasons for that:

  1. The connection is not fast and connection is not reliable! (See below)
  2. Many Office 365 services, like Skype for Business or Sharepoint, need a PowerShell local module and they are not available for non-Windows platforms yet!

I tested all the v6 beta releases and the basic Exchange Online connection worked in some, sometimes better, sometimes not. Even with the latest PowerShell Core v6 RC2 the connection isn't always working or it is very slow during the connection or the import. Connecting to the Compliance Center seems to work like the Exchange Online connection: In general it seems to work… With exactly the same issues.

Copyright © 2018 by Joerg Hochwald. All rights reserved. ● Site is powered by Author