Here is my code below (error below that). It is having issues with the “$Body = hostname” line. The format of the hostname output doesn’t seem to be compatible with the email code, any suggestions?
$BLinfo = Get-Bitlockervolume
$ToAddress = ‘mdaniels@pinnaclefertility.com’
$Subject = ‘PCs with Bitlocker Disabled’
#$Body = Out-String -InputObject (hostname)
$Body = hostname
if($blinfo.ProtectionStatus -eq ‘Off’) {
Import-Module $env:SyncroModule -WarningAction SilentlyContinue
Send-Email -To $ToAddress -Subject $Subject -Body $Body
}
error> System.InvalidOperationException: A circular reference was detected while serializing an object of type ‘System.Management.Automation.PSParameterizedProperty’.
error> Stack:
error> at ConvertTo-Json20, C:\ProgramData\Syncro\bin\module.psm1: line 314
error> at Call-Api, C:\ProgramData\Syncro\bin\module.psm1: line 266
error> at Call-SyncroApi, C:\ProgramData\Syncro\bin\module.psm1: line 249
error> at Send-Email, C:\ProgramData\Syncro\bin\module.psm1: line 138
error> at , C:\ProgramData\Syncro\bin\8b51ec11-f4e0-4dbe-89c4-7270375e9734.ps1: line 12
error> at , : line 1
error> at , : line 1
error> Call-SyncroApi: failure