Skip to content

Instantly share code, notes, and snippets.

@jesseloudon
Created July 4, 2021 07:08
Show Gist options
  • Save jesseloudon/ca111f680603e0edee35a42f23a3e264 to your computer and use it in GitHub Desktop.
Save jesseloudon/ca111f680603e0edee35a42f23a3e264 to your computer and use it in GitHub Desktop.
mmaAddCloudWorkspace.ps1
param(
[string]$workspaceId,
[string]$workspaceKey
)
$mma = New-Object -ComObject 'AgentConfigManager.MgmtSvcCfg'
if ($mma.GetCloudWorkspace($workspaceId).workspaceid -ne $workspaceId)
{
$mma.AddCloudWorkspace($workspaceId, $workspaceKey)
$mma.ReloadConfiguration()
$mma.GetCloudWorkspace($workspaceId).ConnectionStatusText
Write-Verbose "Host $env:COMPUTERNAME is now configured for $workspaceId" -Verbose
}
else
{
Write-Warning "Host $env:COMPUTERNAME already configured for $workspaceId"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment