- 
                Notifications
    You must be signed in to change notification settings 
- Fork 28
Description
Howdy friends!
I was trying to use the BulkSetArchiveSchedule.v04.ps1 to get & set archiving. It doesn't appear to pull any devices. Looks like, perhaps, the Visa is getting rejected.
I added "write-output $data" and "write-output $webrequest" to the Send-GetDevices function and ran ".\BulkSetArchiveSchedule.v04.ps1 -allpartners -alldevices -clearcredentials":
  Bulk Set Archive Schedule
Get-Command : File G:\My Drive\GitHub\Backup-Scripts\Retention\BulkSetArchiveSchedule.v04.ps1 cannot be loaded because
you opted not to run this software now.
At G:\My Drive\GitHub\Backup-Scripts\Retention\BulkSetArchiveSchedule.v04.ps1:64 char:11
+ $Syntax = Get-Command $PSCommandPath -Syntax ; Write-Output "  Script ...
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [Get-Command], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.GetCommandCommand
  Script Parameter Syntax:
  Current Parameters:
  -AllPartners     = True
  -AllDevices      = True
  -Add             = False
  -Name            = EOM Archive
  -Time            = 00:00
  -Months          = all
  -Monthdays       = last
  -Remove          = False
  AddArchiveSchedule
  ---------
  Backup API Credential File Cleared
  ---------
  Getting Backup API Credentials
  ---------
  Backup API Credential File Not Present
  ---------
  Setting Backup API Credentials
  ---------
  Backup API Credential Path Present
  ---------
  Enter Exact, Case Sensitive Partner Name for SolarWinds Backup.Management API i.e. 'Acme, Inc (bob@acme.net)'
  Enter Login Partner Name: Our_Partner_Name
  ---------
  Getting Backup API Credentials
  ---------
  Backup API Credential File Present
  ---------
  Stored Backup API Partner  = Our_Partner_Name
  Stored Backup API User     = My_API_Email
  Stored Backup API Password = Encrypted
  ---------
  ---------
  Our_Partner_Name - Our_Partner_ID - Our_UID
  ---------
  ---------
  All Partners Selected
Name                           Value
----                           -----
visa                           The visa appears here & looks like the visa we got back from the Send-APICredentialsCookie function...
params                         {query}
id                             2
jsonrpc                        2.0
method                         EnumerateAccountStatistics
Content           : {123, 34, 101, 114...}
StatusCode        : 200
StatusDescription :
RawContentStream  : Microsoft.PowerShell.Commands.WebResponseContentMemoryStream
RawContentLength  : 113
RawContent        : HTTP/1.1 200
                    Connection: keep-alive
                    X-Trace: F0681CBA54489CF65D1C229DDF61C97573129D9B
                    Access-Control-Allow-Origin: https://backup.management
                    Access-Control-Allow-Credentials: true
                    Access-Control-Allow-Methods: POST, OPTIONS, GET
                    Access-Control-Allow-Headers: Pragma,Expires,Cache-Control,Content-Type,Authorization
                    Access-Control-Expose-Headers: X-ErrorCode
                    Strict-Transport-Security: max-age=31536000; includeSubDomains
                    Content-Length: 113
                    Content-Type: application/json-rpc
                    Date: Wed, 01 May 2024 16:26:15 GMT
                    {"error":{"code":-32603,"data":1701,"message":"Visa is
                    inconsistent/corrupted."},"id":"jsonrpc","jsonrpc":"2.0"}
BaseResponse      : System.Net.HttpWebResponse
Headers           : {[Connection, keep-alive], [X-Trace, F0681CBA54489CF65D1C229DDF61C97573129D9B],
                    [Access-Control-Allow-Origin, https://backup.management], [Access-Control-Allow-Credentials,
                    true]...}
  ---------
  0 Devices Selected
  ---------
  No Devices Selected
I'm running Windows 11 Pro 23h2. PS version 5.1.22621.2506.
For what it's worth, I can run .\Settings\CoveDataProtection.GetUserViews.v24.02.29.ps1 and it pulls & exports custom user views just fine. So I believe the creds I'm using are valid. The user account I'm using for testing is a SuperUser and has API access enabled.
I've tried to compare the authentication of GetUserViews and BulkSetArchiveSchedule, but have yet been unable to ID a difference that would cause this. Any ideas on what we can try to be able to pull all devices?
Thanks for all you do!!
jake