# # PowerShell 2 # # Export documents from ServiceView # # # Setup ServiceView options # # # URL to connect to ServiceView # $serviceview_api = "http:///get_document.php" # # The value of the SECRET option set in the options setup section. # $serviceview_secret = "" # # Get a specific service only using its service code, blank for all services # $serviceview_service_code = "" # # The service property containing the document # $serviceview_property_code = "" # # Load the JSON decoder # [System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions") $ser = New-Object System.Web.Script.Serialization.JavaScriptSerializer # # Create Web Client # $wc = New-Object Net.WebClient # # Get the summary information # $url = "$($serviceview_api)?secret=$($serviceview_secret)&service_code=$($serviceview_service_code)&property_code=$($serviceview_property_code)" $json = $wc.DownloadString($url) $obj = $ser.DeserializeObject($json) # # Use the filename field # $filename = "$($pwd)\$($obj.filename)"; # # Connect to ServiceView and download the binary # # # Use the return parameter to determin what to return: base64encoded, binary or blank for headers only # $url = "$($serviceview_api)?secret=$($serviceview_secret)&service_code=$($serviceview_service_code)&property_code=$($serviceview_property_code)&return=binary" $wc.DownloadFile($url, $filename)