Skip to content

Instantly share code, notes, and snippets.

@ebibibi
Created February 24, 2022 08:22
Show Gist options
  • Select an option

  • Save ebibibi/564d7439a3cb300610f35af359acb5a1 to your computer and use it in GitHub Desktop.

Select an option

Save ebibibi/564d7439a3cb300610f35af359acb5a1 to your computer and use it in GitHub Desktop.
#Install-Module -Name PSDscResources -Scope AllUsers -Verbose -Force
Configuration InstallOpsRampClient
{
param()
Import-DscResource -ModuleName PSDscResources -ModuleVersion 2.12.0.0
Node "localhost"
{
MsiPackage OpsRampAgent
{
Ensure = "Present"
Path = "https://opsrampmanagementst.blob.core.windows.net/agentinstaller/OpsRampAgent.msi"
#Name = "OpsRamp Agent"
ProductId = "0495E7C9-50C7-4464-AC2D-5D2FC6800E58"
Arguments = 'WRAPPED_ARGUMENTS="/silent /apiserver=jpdemopod2.api.opsramp.com /key=xxxxxxxxxxxxxxxxx /secret=xxxxxxxxxxxxxxxxx /clientid=4cdff377-7a51-46e2-8d9a-7abaed7d3b13"'
}
}
}
#Start-DscConfiguration -Path 'C:\tmp\InstallOpsRampClient' -Wait -Verbose
$version = '1.0.0'
$ConfigName = "OpsRampAgentInstall_$version"
$MofPath = '.\localhost.mof'
$ResourceGroupName = 'OpsRampManagement'
$StorageAccountName = 'opsrampmanagementst'
$DisplayName = 'OpsRamp Agent Install for Windows'
$Description = 'Install OpsRamp Agent to Windows Server'
$policyId = "OpsRampAgentInstallWindows_$version"
$platform = 'Windows'
$mode = 'ApplyAndAutoCorrect'
InstallOpsRampClient -OutputPath:(Get-Location)
$contenturi = New-GuestConfigurationPackage -Name $ConfigName -Configuration $MofPath -Path ./package/ -Type AuditAndSet -Force |
Publish-GuestConfigurationPackage -ResourceGroupName $ResourceGroupName -StorageAccountName $StorageAccountName -Force | ForEach-Object ContentUri
Start-Sleep 60
New-GuestConfigurationPolicy -PolicyId $policyId -DisplayName $DisplayName -Description $Description -Path './policies' -Platform $platform -Version $version -Mode $mode -ContentUri $contenturi|
Publish-GuestConfigurationPolicy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment