Reply to Message

View discussion in a popup

Replying to:
Dinu26
Contributor
Contributor

Hi LucD,

Thanks Much for the response.

Am being dumb here,

Have tried passing the host name through alarm as well as script, But am unable to figure it out.

I tried with TargetName and VMWARE_ALARM_TARGET_NAME but no luck

pastedImage_0.png

Below is what I have in TT.cmd.

Set Parm1= {VMWARE_ALARM_TARGET_NAME}

echo "am being called" >> "C:\ProgramData\VMware\VMware VirtualCenter\scripts\test.txt"

echo Parm1 >> "C:\ProgramData\VMware\VMware VirtualCenter\scripts\test.txt"

C:\Windows\System32\cmd.exe /c powershell.exe -noninteractive -noprofile -file "C:\ProgramData\VMware\VMware VirtualCenter\scripts\tt.ps1" %Parm1%

Below is the code in tt.ps1

[CmdletBinding()]

Param(

[Parameter(Mandatory=$True,Position=1)]

[string]$Test

)

write-host $Test

$ExchangeServer = "***********"

$FromAddress = "**********"

$to = "**************"

$te =  "Am being called by Alarm"

$te | Out-File -filepath "C:\ProgramData\VMware\VMware VirtualCenter\scripts\test.txt" -Append

Send-MailMessage -from $FromAddress -To $to -Body "test 1 and $Test" -Subject "top" -SmtpServer $ExchangeServer

Reply
0 Kudos