I am attempting to synchronize information from VMware, AD, and SCCM into my Orion environment. So far I am working with the following custom properties.
Backup_Policy-- Taken from VM note field
OS_Update_Schedule--calculated based on active directory membership
Comments--Based on description from AD
Here is what I have:
#Clear Variables
$server= @()
$NodeDetail=@()
$Description=@()
$NodeNumber=@()
$servername=@()
$Backup_policy=@()
$Memberof=@()
$IP=@()
##Gather Inforamtion
Get-ADComputer -Filter {OperatingSystem-Like"Windows Server*"} -SearchBase"OU=Test ,DC=local"-PropertiesName,Description,ipv4address,memberof|Foreach-Object{
$NodeDetail=New-object-TypeNamePSObject-property @{
Server=$_.name
Backup_Policy=Get-VM$_.Name |Select-Object-ExpandPropertyNotes
Description =$_.description
NodeNumber =Get-OrionNodeID-Swisconnection$swis-NodeName$_.name
IP=$_.ipv4address
memberof=$_.memberof
}
If ($NodeDetail.NodeNumber -gt"0")
{$ServerList+=$NodeDetail}
Else{$AddtoOrion+=$NodeDetail}
}
$NodeNum=$nodedetail.NodeNumber
$NodeDesc=$nodedetail.Description
$BackupPol=$nodedetail.Backup_Policy
$UpdateSchedule=$nodedetail.memberof
##Sync Gathered Info with SW
foreach ($serverin$ServerList)
{
If ($UpdateSchedule-eq"CN=MW-SRV Thursday,OU=Maintenance Windows ")
{
$Customproperties=@{
Comments=$nodedetail.Description;
Backup_Policy=$nodedetail.Backup_Policy;
OS_Update_Schedule="Thursday following patch Tuesday";
}
Set-SwisObject$swis swis://./Orion/Orion.Nodes/NodeID=$nodenum/CustomProperties$Customproperties
}
Elseif ($UpdateSchedule-eq"CN=MW-SRV Sunday 2,OU=Maintenance Windows")
{
$Customproperties=@{
Comments=$nodedetail.Description;
Backup_Policy=$nodedetail.Backup_Policy;
OS_Update_Schedule="Sunday following patch Tuesday"
}
Set-SwisObject$swisswis://./Orion/Orion.Nodes/NodeID=$nodenum/CustomProperties$Customproperties
}
Elseif ($UpdateSchedule-eq"CN=MW-SRV Sunday 3,OU=Maintenance Windows")
{
$Customproperties=@{
Comments=$nodedetail.Description;
Backup_Policy=$nodedetail.Backup_Policy;
OS_Update_Schedule="2nd Sunday following patch Tuesday"
}
Set-SwisObject$swisswis://./Orion/Orion.Nodes/NodeID=$nodenum/CustomProperties$Customproperties
}
}
(I had this working, however I made some revisions that got saved, I went on vacation now I am back it is no longer working. The broken code is above. I do not understand how I got it to work before so now I am reaching out for help )
Now when I run it, it doesn't create any errors. It just doesn't update Orion. Looking for advice on how I can sync the information from the multiple sources to orion.
Thank you