
#POWERSHELL IP SCANNER CODE#
Each computer is represented with code that is similar to the following example: įor example, $ file="$HOME\Documents\computers_status.json" saves the file below your home directory.Įnter the following command to send the request: Invoke-RestMethod "$url/api/computers?expand=$expand" -Headers $headers -OutFile $file (The Web browser should format the JSON so that it is readable.) You should see JSON code that represents an array of computers. In the above command, replace > $file with | jq. To print the returned JSON in the terminal in a readable format (instead of writing to a file), pipe the results of the cURL command to jq. json extension:įor example, file=~/Documents/computers_status.json saves the file below your home directory.Įnter the following command to send the request:Ĭurl -X GET "$url/api/computers?expand=$expand" -H "api-secret-key: $secret" -H "api-version: v1" > $file Open Terminal or your preferred command line tool.Įnter the following commands to store details about your request, replacing with the URL of Workload Security, and with the secret from your API key:įor example, secret=5C58EADA-04BC-4ABC-45CF-B72925A0B674:aFBgpPV8eJQGaY2Dk0LmyQMD7nUGvyIDfIbIQo8Zgm8=Įnter the following command to specify the JSON file where you want to save the response data, replacing with the file to create.Gather the following information that you need to complete this recipe:

You should have already verified that your environment is set up to use the API using Bash or PowerShell. Category of returned informationĪllSecurityModules (includes information for all modules), antiMalware, applicationControl, firewall, integrityMonitoring, intrusionPrevention, logInspection, SAP, webReputationĪllVirtualMachineSummaries (includes information for all types of virtual machines), azureARMVirtualMachineSummary, azureVMVirtualMachineSummary, ec2VirtualMachineSummary, ESXSummary, noConnectorVirtualMachineSummary, vcloudVMVirtualMachineSummary, vmwareVMVirtualMachineSummary, workspaceVirtualMachineSummary, When you do not include the expand query string, all computer information is returned. At a minimum the basic information about each computer is returned, such as the computer ID, policy ID, and platform. You can use the expand query parameter so that only the information in which you are interested is returned. When you list computers, by default all available computer information is returned. Use the optional expand query parameter to focus on the status information. Use the List Computers operation to get a list of computers.

Get a list of the computers that Workload Security protects (or has detected) and focus the returned data to include the security status of each computer. Get a List of Computers (Bash and PowerShell)
