Backup-Scripts icon indicating copy to clipboard operation
Backup-Scripts copied to clipboard

BulkSetArchiveSchedule.v04.ps1 Returns Inconsistent Visa

Open jake-ct opened this issue 1 year ago • 1 comments
trafficstars

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 ([email protected])'
  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

jake-ct avatar May 01 '24 16:05 jake-ct

I’ll take a look. Thanks for the heads up.


Regards

Eric Harless | HEAD BACKUP NERD | N-ABLE

mobile: 631-512-0140 | email: @.@.>

eventshttps://www.n-able.com/events | blogshttps://www.n-able.com/?s=backup_nerd+blog | twitterhttps://twitter.com/backup_nerd | linkedinhttps://www.linkedin.com/in/backupnerd/ | reddithttps://www.reddit.com/r/Nable/ | scriptshttps://github.com/BackupNerd | cookbookhttps://success.n-able.com/cookbooks/ | meethttps://calendly.com/backup_nerd/backup-meeting

support | release | status | documentation | training | resourceshttps://success.n-able.com/product/backup


From: jake-ct @.> Sent: Wednesday, May 1, 2024 12:59:33 PM To: BackupNerd/Backup-Scripts @.> Cc: Subscribed @.***> Subject: [BackupNerd/Backup-Scripts] BulkSetArchiveSchedule.v04.ps1 Returns Inconsistent Visa (Issue #12)

[EXTERNAL] This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

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 @.***)' 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

— Reply to this email directly, view it on GitHubhttps://github.com/BackupNerd/Backup-Scripts/issues/12, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQP57KO23KJ7RD6ZTC2RQPTZAENPLAVCNFSM6AAAAABHCH7HW6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3TGOBSHE4TENA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

BackupNerd avatar May 01 '24 17:05 BackupNerd