Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant assign pre and post scripts to a database #786

Open
clumnah opened this issue Oct 21, 2021 · 0 comments
Open

Cant assign pre and post scripts to a database #786

clumnah opened this issue Oct 21, 2021 · 0 comments
Labels

Comments

@clumnah
Copy link
Contributor

clumnah commented Oct 21, 2021

What happened:

Trying to run the below code

Import-Module Rubrik
$token="removed"
Connect-Rubrik -Server Rubrik -token $token
$Rubrikdatabase = Get-RubrikDatabase -ServerInstance "SQLServer" -Name "Database"
set-rubrikdatabase -id $Rubrikdatabase.id -PreScriptPath "C:\Rubrik_Scripts\Lock_PRD_Stage.bat" -PreScriptErrorAction "continue" -PreTimeoutMs 300 -Verbose
#set-rubrikdatabase -id $Rubrikdatabase.id -PostScriptPath "C:\Rubrik_Scripts\UnLock_PRD_Stage.bat" -PostScriptErrorAction continue -PostTimeoutMs 300

Getting the below results

VERBOSE: Validate the Rubrik token exists

VERBOSE: Found a Rubrik token for authentication

VERBOSE: Gather API Data for Set-RubrikDatabase

VERBOSE: Selected 1.0 API Data for Set-RubrikDatabase

VERBOSE: Load API data for Set-RubrikDatabase

VERBOSE: Description: Updates Rubrik database settings.

VERBOSE: Build the URI

VERBOSE: URI = https://*************/api/v1/mssql/db/MssqlDatabase:::22685423-601e-4b25-a6ec-89025a0f5ab6

VERBOSE: List of set parameters: [id, MssqlDatabase:::22685423-601e-4b25-a6ec-89025a0f5ab6] [PreScriptPath, C:\Rubrik_Scripts\Lock_PRD_Stage.bat] [PreScriptErrorAction, continue] [PreTimeoutMs, 300] [Verbose, True]

VERBOSE: Build the body parameters

VERBOSE: Adding copyOnly...

VERBOSE: Adding configuredSlaDomainId...

VERBOSE: Adding preBackupScript...

VERBOSE: Adding postBackupScript...

VERBOSE: No body for this request

ConvertFrom-Json : Invalid JSON primitive: System.Collections.Hashtable.

At C:\Program Files\WindowsPowerShell\Modules\Rubrik\5.3.1\Public\Set-RubrikDatabase.ps1:190 char:19

+       $bodytemp = ConvertFrom-Json $body

+                   ~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [ConvertFrom-Json], ArgumentException

    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand


Add-Member : Cannot bind argument to parameter 'InputObject' because it is null.

At C:\Program Files\WindowsPowerShell\Modules\Rubrik\5.3.1\Public\Set-RubrikDatabase.ps1:192 char:19

+ ... $bodytemp | Add-Member -MemberType NoteProperty -Name 'preBackupScrip ...

+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidData: (:) [Add-Member], ParameterBindingValidationException

    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.AddMemberCommand


VERBOSE: Submitting the request

VERBOSE: Invoking request with a custom timeout of 100 seconds

VERBOSE: PATCH https://**************/api/v1/mssql/db/MssqlDatabase:::22685423-601e-4b25-a6ec-89025a0f5ab6 with 0-byte payload

Invoke-WebRequest : Request malformed

At C:\Program Files\WindowsPowerShell\Modules\Rubrik\5.3.1\Private\Invoke-RubrikWebRequest.ps1:36 char:23

+ ...   $result = Invoke-WebRequest -UseBasicParsing -TimeoutSec $rubrikOpt ...

+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException

    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

What you expected to happen:

The expected out come is to set a database protected by Rubrik to have a pre or post script run when the backup happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant