Get-ADReplicationFailure PowerShell DataSource
I created a datasource that runs Get-ADReplicationFailure on Domain Controllers. It works great most of the time however on servers that do not have Active Directory Module for Windows PowerShell installed it isn't recognized. I would like to add an Import-Module ActiveDirectory line somewhere in my script but I am not having much luck. All of you probably know PowerShell better than me which has led me here. :)/emoticons/smile@2x.png 2x" title=":)" width="20" />
Here is my AD script.
$name = '##system.hostname##'
# get an array of all partner servers
$partner_array = Get-ADReplicationFailure $name;
# iterate through the partmer array
foreach ($partner in $partner_array)
{
# get the information from the partner array
$PartnerGuid = $partner.PartnerGuid;
$instance_name = "Partner: " + $partner.Partner;
$instance_desc = $partner.Server;
# write out the instance data
Write-Host "$PartnerGuid##$instance_name";
}
Remove-PSSession $Session
## Make sure we fully terminate the script.
exit
# return with a response code that indicates we ran successfully
Exit 0;