Open clumnah opened 3 years ago
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
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
The expected out come is to set a database protected by Rubrik to have a pre or post script run when the backup happens.
What happened:
Trying to run the below code
Getting the below results
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.