Skip to content

Commit cfc40ff

Browse files
authored
Update agent-windows.md
1 parent f7191e8 commit cfc40ff

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

articles/azure-monitor/platform/agent-windows.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -135,41 +135,41 @@ To retrieve the product code from the agent install package directly, you can us
135135
1. Create Azure Automation variable assets for *OPSINSIGHTS_WS_ID* and *OPSINSIGHTS_WS_KEY*. Set *OPSINSIGHTS_WS_ID* to your Log Analytics workspace ID and set *OPSINSIGHTS_WS_KEY* to the primary key of your workspace.
136136
1. Copy the script and save it as MMAgent.ps1.
137137
138-
```powershell
139-
Configuration MMAgent
140-
{
141-
$OIPackageLocalPath = "C:\Deploy\MMASetup-AMD64.exe"
142-
$OPSINSIGHTS_WS_ID = Get-AutomationVariable -Name "OPSINSIGHTS_WS_ID"
143-
$OPSINSIGHTS_WS_KEY = Get-AutomationVariable -Name "OPSINSIGHTS_WS_KEY"
144-
145-
Import-DscResource -ModuleName xPSDesiredStateConfiguration
146-
Import-DscResource -ModuleName PSDesiredStateConfiguration
147-
148-
Node OMSnode {
149-
Service OIService
150-
{
151-
Name = "HealthService"
152-
State = "Running"
153-
DependsOn = "[Package]OI"
154-
}
155-
156-
xRemoteFile OIPackage {
157-
Uri = "https://go.microsoft.com/fwlink/?LinkId=828603"
158-
DestinationPath = $OIPackageLocalPath
159-
}
160-
161-
Package OI {
162-
Ensure = "Present"
163-
Path = $OIPackageLocalPath
164-
Name = "Microsoft Monitoring Agent"
165-
ProductId = "8A7F2C51-4C7D-4BFD-9014-91D11F24AAE2"
166-
Arguments = '/C:"setup.exe /qn NOAPM=1 ADD_OPINSIGHTS_WORKSPACE=1 OPINSIGHTS_WORKSPACE_ID=' + $OPSINSIGHTS_WS_ID + ' OPINSIGHTS_WORKSPACE_KEY=' + $OPSINSIGHTS_WS_KEY + ' AcceptEndUserLicenseAgreement=1"'
167-
DependsOn = "[xRemoteFile]OIPackage"
168-
}
169-
}
170-
}
171-
172-
```
138+
```powershell
139+
Configuration MMAgent
140+
{
141+
$OIPackageLocalPath = "C:\Deploy\MMASetup-AMD64.exe"
142+
$OPSINSIGHTS_WS_ID = Get-AutomationVariable -Name "OPSINSIGHTS_WS_ID"
143+
$OPSINSIGHTS_WS_KEY = Get-AutomationVariable -Name "OPSINSIGHTS_WS_KEY"
144+
145+
Import-DscResource -ModuleName xPSDesiredStateConfiguration
146+
Import-DscResource -ModuleName PSDesiredStateConfiguration
147+
148+
Node OMSnode {
149+
Service OIService
150+
{
151+
Name = "HealthService"
152+
State = "Running"
153+
DependsOn = "[Package]OI"
154+
}
155+
156+
xRemoteFile OIPackage {
157+
Uri = "https://go.microsoft.com/fwlink/?LinkId=828603"
158+
DestinationPath = $OIPackageLocalPath
159+
}
160+
161+
Package OI {
162+
Ensure = "Present"
163+
Path = $OIPackageLocalPath
164+
Name = "Microsoft Monitoring Agent"
165+
ProductId = "8A7F2C51-4C7D-4BFD-9014-91D11F24AAE2"
166+
Arguments = '/C:"setup.exe /qn NOAPM=1 ADD_OPINSIGHTS_WORKSPACE=1 OPINSIGHTS_WORKSPACE_ID=' + $OPSINSIGHTS_WS_ID + ' OPINSIGHTS_WORKSPACE_KEY=' + $OPSINSIGHTS_WS_KEY + ' AcceptEndUserLicenseAgreement=1"'
167+
DependsOn = "[xRemoteFile]OIPackage"
168+
}
169+
}
170+
}
171+
172+
```
173173

174174
4. Update the `ProductId` value in the script with the product code extracted from the latest version of the agent install package using the methods recommended earlier.
175175
5. [Import the MMAgent.ps1 configuration script](../../automation/automation-dsc-getting-started.md#importing-a-configuration-into-azure-automation) into your Automation account.

0 commit comments

Comments
 (0)