Skip to content

Commit acf03cf

Browse files
committed
code
1 parent be94904 commit acf03cf

File tree

1 file changed

+32
-73
lines changed

1 file changed

+32
-73
lines changed

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

Lines changed: 32 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -132,85 +132,44 @@ The 32-bit and 64-bit versions of the agent package have different product codes
132132
To retrieve the product code from the agent install package directly, you can use Orca.exe from the [Windows SDK Components for Windows Installer Developers](https://msdn.microsoft.com/library/windows/desktop/aa370834%28v=vs.85%29.aspx) that is a component of the Windows Software Development Kit or using PowerShell following an [example script](https://www.scconfigmgr.com/2014/08/22/how-to-get-msi-file-information-with-powershell/) written by a Microsoft Valuable Professional (MVP). For either approach, you first need to extract the **MOMagent.msi** file from the MMASetup installation package. This is shown earlier in the first step under the section [Install the agent using the command line](#install-the-agent-using-the-command-line).
133133
134134
1. Import the xPSDesiredStateConfiguration DSC Module from [https://www.powershellgallery.com/packages/xPSDesiredStateConfiguration](https://www.powershellgallery.com/packages/xPSDesiredStateConfiguration) into Azure Automation.
135-
<<<<<<< HEAD
136135
2. 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.
137136
3. Copy the script and save it as MMAgent.ps1.
138137
139-
```powershell
140-
Configuration MMAgent
141-
{
142-
$OIPackageLocalPath = "C:\Deploy\MMASetup-AMD64.exe"
143-
$OPSINSIGHTS_WS_ID = Get-AutomationVariable -Name "OPSINSIGHTS_WS_ID"
144-
$OPSINSIGHTS_WS_KEY = Get-AutomationVariable -Name "OPSINSIGHTS_WS_KEY"
145-
146-
Import-DscResource -ModuleName xPSDesiredStateConfiguration
147-
Import-DscResource -ModuleName PSDesiredStateConfiguration
148-
149-
Node OMSnode {
150-
Service OIService
151-
{
152-
Name = "HealthService"
153-
State = "Running"
154-
DependsOn = "[Package]OI"
155-
}
156-
157-
xRemoteFile OIPackage {
158-
Uri = "https://go.microsoft.com/fwlink/?LinkId=828603"
159-
DestinationPath = $OIPackageLocalPath
160-
}
161-
162-
Package OI {
163-
Ensure = "Present"
164-
Path = $OIPackageLocalPath
165-
Name = "Microsoft Monitoring Agent"
166-
ProductId = "8A7F2C51-4C7D-4BFD-9014-91D11F24AAE2"
167-
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"'
168-
DependsOn = "[xRemoteFile]OIPackage"
169-
}
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"
170168
}
171169
}
170+
}
172171
173-
```
174-
=======
175-
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.
176-
1. Copy the script and save it as MMAgent.ps1.
177-
178-
```powershell
179-
Configuration MMAgent
180-
{
181-
$OIPackageLocalPath = "C:\Deploy\MMASetup-AMD64.exe"
182-
$OPSINSIGHTS_WS_ID = Get-AutomationVariable -Name "OPSINSIGHTS_WS_ID"
183-
$OPSINSIGHTS_WS_KEY = Get-AutomationVariable -Name "OPSINSIGHTS_WS_KEY"
184-
185-
Import-DscResource -ModuleName xPSDesiredStateConfiguration
186-
Import-DscResource -ModuleName PSDesiredStateConfiguration
187-
188-
Node OMSnode {
189-
Service OIService
190-
{
191-
Name = "HealthService"
192-
State = "Running"
193-
DependsOn = "[Package]OI"
194-
}
195-
196-
xRemoteFile OIPackage {
197-
Uri = "https://go.microsoft.com/fwlink/?LinkId=828603"
198-
DestinationPath = $OIPackageLocalPath
199-
}
200-
201-
Package OI {
202-
Ensure = "Present"
203-
Path = $OIPackageLocalPath
204-
Name = "Microsoft Monitoring Agent"
205-
ProductId = "8A7F2C51-4C7D-4BFD-9014-91D11F24AAE2"
206-
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"'
207-
DependsOn = "[xRemoteFile]OIPackage"
208-
}
209-
}
210-
}
211-
212-
```
213-
>>>>>>> c0c834d64a67f2795e374b5ec1d75889e0de3df4
172+
```
214173

215174
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.
216175
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)