How to deploy OMS Log Analytics Agent and Dependency Agent using DSC
# replace the ??????????? in the script Configuration MMAgent { $OIPackageLocalPath = "$env:temp\MMASetup-AMD64.exe" $SMapPackageLocalPath = "$env:temp\InstallDependencyAgent-Windows.exe" $OPSINSIGHTS_WS_ID = "??????????????" $OPSINSIGHTS_WS_KEY = "??????????????" Import-DscResource -ModuleName xPSDesiredStateConfiguration Node SQLnode { } Node OMSnode { Service OIService { Name = "HealthService" State = "Running" DependsOn = "[xPackage]OMSAgent" } Service DependencyService { Name = "MicrosoftDependencyAgent" State = "Running" DependsOn = "[xPackage]SmapAgent" } xRemoteFile OIPackage { Uri = "https://go.microsoft.com/fwlink/?LinkId=828603" DestinationPath = $OIPackageLocalPath } xRemoteFile SmapPackage { Uri = "https://aka.ms/dependencyagentwindows" DestinationPath = $SMapPackageLocalPath } xPackage OMSAgent { Ensure = "Present" Path = $OIPackageLocalPath Name = "Microsoft Monitoring Agent" ProductId = "" Arguments = '/C:"setup.exe /qn ADD_OPINSIGHTS_WORKSPACE=1 OPINSIGHTS_WORKSPACE_ID=' + $OPSINSIGHTS_WS_ID + ' OPINSIGHTS_WORKSPACE_KEY=' + $OPSINSIGHTS_WS_KEY + ' AcceptEndUserLicenseAgreement=1"' DependsOn = "[xRemoteFile]OIPackage" } #6D765BA4-C090-4C41-99AD-9DAF927E53A5 xPackage SmapAgent { Path = $SMapPackageLocalPath Ensure = 'Present' Name = 'Dependency Agent' ProductId = '' Arguments = '/S' DependsOn = '[xPackage]OMSAgent', '[xRemoteFile]SmapPackage' } } }