# # # PowerShell 2 # # Send service and equipment data to ServiceView # # # URL to connect to ServiceView # $serviceview_api = "http:///put_event.php" # # The value of the SECRET option set in the options setup section. # $serviceview_secret = "" # # Build the connect URL # $url = "$($serviceview_api)?secret=$($serviceview_secret)" # # Load the JSON encoder/decoder # [System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions") $ser = New-Object System.Web.Script.Serialization.JavaScriptSerializer # # Create Web Client # $wc = New-Object Net.WebClient # # Setup the POST values # $nvc = new-object System.Collections.Specialized.NameValueCollection $nvc.Add('service_code','Blackboard') $nvc.Add('start','2013-12-03 12:00:00') $nvc.Add('end','2013-12-03 13:30:00') $nvc.Add('title','Blackboard Servers Upgrade2') $nvc.Add('description','Blackboard Servers will be upgraded today') $nvc.Add('service_availability','1') # 1 = Not available, 2 = Some impact, 3 = No impact $nvc.Add('event_group_id','4') # 2 = Unscheduled, 4 = Scheduled, 9 = For Information $nvc.Add('public_fg','yes') $nvc.Add('event_status_id','1') # 1 = Active, 2 = Resolved # # Create a web client object # $wc = new-object net.webclient # # Pass in URL and POST data # $webpage = $wc.UploadValues($url, $nvc) # # See what came back # $ret = [System.Text.Encoding]::ASCII.GetString($webpage) echo $ret