Monday, January 16, 2017

Using PowerShell to call API

Below is a sample PowerShell script that call an sms API.

# powershell -ExecutionPolicy Bypass -File "FIlename"
$yourUri = "http://gateway.yesmsfusion.no/V1/smsapi.asmx/SendSms"
Invoke-WebRequest -Uri $yourUri -Method Post -Body @{
apiKey="LJLKJL233RNL3ACLSZB3M6ZOU19K"
receipient="+639171234567"
message="Het buddy! call me when your FREE. - PowerShell"
replyPath=""
originator="Biboy"
}

Wednesday, January 11, 2017

Send email notification using PowerShell sripting when there is an Error or Warning Event

Send email notification using PowerShell scripting when there is an Error or Warning Event

1. Create a schedule task, on an Event trigger
2. Create .ps1 file that will email you
3. Enable the Schedule Task