$RAAccount = Get-SCOMRunAsAccount -Name 'Microsoft.SystemCenter.Advisor.RunAsAccount.Certificate'
$RAProfile = Get-SCOMRunAsProfile -Name 'P2P.OMSAdministration.CertificateRunAs'
Try
{
$TargetClass = Get-SCOMClass -Name 'P2P.OMSAdministration.Classes.OMSInstallation'
Set-SCOMRunAsProfile -Action "Add" -Profile $RAProfile -Account $RAAccount -Class $TargetClass
}
Catch
{
#we Already have this in our profile and there doesn't appear to be a way to detect it
}
Try
{
$TargetClass = Get-SCOMClass -Name 'P2P.OMSAdministration.Classes.OMSManagementPackBundle'
Set-SCOMRunAsProfile -Action "Add" -Profile $RAProfile -Account $RAAccount -Class $TargetClass
}
Catch
{
#we Already have this in our profile and there doesn't appear to be a way to detect it
}
Try
{
$TargetClass = Get-SCOMClass -Name 'P2P.OMSAdministration.Classes.OMSSolution'
Set-SCOMRunAsProfile -Action "Add" -Profile $RAProfile -Account $RAAccount -Class $TargetClass
}
Catch
{
#we Already have this in our profile and there doesn't appear to be a way to detect it
}
Try
{
$TargetClass = Get-SCOMClass -Name 'P2P.OMSAdministration.Classes.OMSManagementPack'
Set-SCOMRunAsProfile -Action "Add" -Profile $RAProfile -Account $RAAccount -Class $TargetClass
}
Catch
{
#we Already have this in our profile and there doesn't appear to be a way to detect it
}
Try
{
$TargetClass = Get-SCOMClass -Name 'Microsoft.SystemCenter.RootManagementServer'
Set-SCOMRunAsProfile -Action "Add" -Profile $RAProfile -Account $RAAccount -Class $TargetClass
}
Catch
{
#we Already have this in our profile and there doesn't appear to be a way to detect it
}]]></Script></ScriptBody>
<SnapIns/>
<Parameters/>
<TimeoutSeconds>300</TimeoutSeconds>
<StrictErrorHandling>true</StrictErrorHandling>
</WriteAction>
</Task>