What permissions are needed by the user account to run SWIS queries from Powershell? I want to minimise the permissions assigned to the user in the script, but my script only returns data when I give the account admin permissions.
Import-Module SwisPowerShell
$OrionServer = 'myserver'
$Username = 'myuser'
$Password = 'password'
$swis = Connect-Swis -Hostname $OrionServer -Username $Username -Password $Password
$query = "
SELECT TOP 10 AuditEventID, TimeLoggedUtc, AccountID, ActionTypeID, AuditEventMessage, NetworkNode, NetObjectID, NetObjectType, AuditingEvents.AuditingActionType.ActionTypeDisplayName
FROM Orion.AuditingEvents
WHERE ActionTypeID IN (1, 3, 4, 5, 19, 20, 21, 25, 33, 35, 38, 48, 73, 74, 75, 93, 94, 102, 103, 163, 164)
"
$results = Get-SwisData $swis $query
$results | ConvertTo-Json -Compress | Write-Output