I needed a script that would automatically get all of the ip addresses for my stores and then upload them to Microsoft on a weekly basis and create a trusted location. I did this so that we wouldn’t have to use MFA for all of the stores and they would be able to log in with just their username and password. Since all of the data was sitting in Meraki I decided to pull it from there and then upload it to Microsoft. Here is the script that goes through all of the wireless devices in my Meraki org and then updates Microsoft with that data and sends an email when it’s been done successfully. I’ve posted the script for reference and anonymized the portions of the script that I didn’t put into the cred.py file.
I used the wireless devices from the Meraki cloud because they were easier to pull out and integrate into the script.
I posted the code to my GitHub repository so that others can see what I did and make recommendations for changes or other things that should be added.
https://github.com/undrwatr/Update_Location
Future changes for the script:
Keep just one database of the ip addresses and update it as needed instead of creating a new site
Additional error checking in case the script doesn’t run