This script was created to help our customer needs to Install ServiceMap and MMA Agents then Update this Agent with Azure OMS workspaceID And workspaceKey, optionally Configure Proxy
I had a customer requirement to push MMA and Dependency Agent automatically on 530 VMs with specific configuration as they already have SCOM in place, for that purpose I created two scripts one for just modifying the current MMA agent and configure to push their logs to SCOM as well as OMS gateway and the second one is just to replace the current MMA agent with the new MMA one and its configuration.  then added both to SCCM for normal deployment.
Here I’m sharing with you a kind of combined script which includes both functionalities with clear NOTES,  hence you have the right to just use the script as-is or remove region which not part of your target.
For more information on the script and to download it, please check TechNet Post; here.


Microsoft MVP & MCT | Azure Service Delivery Lead with over 12 years of experience in Microsoft solutions and Professional services, Leading the Azure team to help our customers to build successful Azure practices, Blogger, Speaker, and Community leader. Focus on Azure, Cloud Security, Modern Workspace, AVD, Infrastructure as Code, Endpoint Management, Office 365, EMS.