diff --git a/Update Rubrik.xml b/Update Rubrik.xml new file mode 100644 index 0000000..b4e164f Binary files /dev/null and b/Update Rubrik.xml differ diff --git a/backup.ps1 b/backup.ps1 index adb3945..233b21d 100644 --- a/backup.ps1 +++ b/backup.ps1 @@ -1,7 +1,13 @@ +# +# backup.ps1 +# +# TODO: Update cleanup time based on backup type + + $sqlInstance = "sqlfcsql\TESTINST" #$directory = "H:\Backup" $directory = "C:\Rubrik\mount" -$fullBackupDay = 'Wednesday' +$fullBackupDay = 'Tuesday' $cleanupTime = 24 $checkCluster = $false diff --git a/claimInstance.ps1 b/claimInstance.ps1 index 31444a9..40890f5 100644 --- a/claimInstance.ps1 +++ b/claimInstance.ps1 @@ -1,21 +1,18 @@ ########################################################################## # -# On Demand Snapshot for all Oracle DBs with a specific SLA -# Created by Rubrik PS for McDermott, September 2025 +# Update an SLA MV to point to the local host +# Created by Rubrik PS for ZF, September 2025 # # Must be run with a Global service account. # # Requires RubrikSecurityCloud module to be installed and working with -# a Global Service Account with the following rights: -# -# - Data Management / Oracle / On-Demand Snapshot -# - Data Management / SLAs / Both Source and Target SLAs +# a Global Service Account with the following rights (TBC) # # Create the service account file with: # Set-RscServiceAccountFile sa.json -OutputFilePath Global.xml # # Example invocation -# .\monthlySnap.ps1 -sourceSla "Prod Oracle SLA" -triggerSla "Oracle Monthly Only" +# .\claimInstance.ps1 -sqlInstance "sqlfcsql\TESTINST" -mvName "JP-ZF-SQL" # # v0.1 Initial Release # @@ -24,7 +21,7 @@ param ( [Parameter(Mandatory=$False, HelpMessage="Instance to claim")] - [string]$sourceSla, + [string]$sqlInstance, [Parameter(Mandatory=$False, HelpMessage="Do not change the MV")] @@ -47,7 +44,7 @@ $ErrorActionPreference = 'Stop' function Write-Log($message) { $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" $logEntry = "$timestamp $message" - Add-Content -Path "C:\Rubrik\monthlySnap.log" -Value $logEntry + Add-Content -Path $logFile -Value $logEntry Write-Host $logEntry } @@ -103,7 +100,7 @@ if ($myHost.Id -ne $mvDetail.hostDetail.Id) { $query.Var.input.Id = $mvDetail.Id $query.Var.input.update.Name = $mvName $query.Var.input.update.config.SmbDomainName = $mvDetail.SmbShare.DomainName - $query.Var.input.update.config.SmbValidIps = $mvDetail.SmbShare.ValidIps + $query.Var.input.update.config.SmbValidIps = $myHost.Name $query.Var.input.update.config.SmbValidUsers = $mvDetail.SmbShare.ValidUsers + $mvDetail.SmbShare.ActiveDirectoryGroups $query.Var.input.update.slaClientConfig.clientHostId = $myHost.Id $query.Var.input.update.slaClientConfig.channelHostMountPaths = $mvDetail.ClientConfig.ChannelHostMountPaths diff --git a/failover.cmd b/failover.cmd new file mode 100644 index 0000000..b2d9f49 --- /dev/null +++ b/failover.cmd @@ -0,0 +1,2 @@ +@echo off +"C:\Program Files\PowerShell\7\pwsh.exe" -ExecutionPolicy Bypass -File "%~dp0claimInstance.ps1"