forked from rubrikinc/rubrik-scripts-for-powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinvoke-sqlondemand.ps1
More file actions
26 lines (20 loc) · 904 Bytes
/
invoke-sqlondemand.ps1
File metadata and controls
26 lines (20 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
param($ServerInstance
,$RubrikServer
,$RubrikCredential = (Get-Credential -Message 'Please enter your Rubrik credentials')
)
#Parse ServerInstance
if($ServerInstance -contains '\'){
$HostName = ($ServerInstance -split '\')[0]
$InstanceName = ($ServerInstance -split '\')[1]
} else {
$HostName = $ServerInstance
$InstanceName = 'MSSQLSERVER'
}
#Connect to the Rubrik Cluster
Connect-Rubrik -Server $RubrikServer -Credential $RubrikCredential
$dbs = Get-RubrikDatabase -Hostname $HostName -Instance $InstanceName | Get-RubrikDatabase | Where-Object {$_.isrelic -ne 'TRUE' -and $_.isLiveMount -ne 'TRUE'}
$dbs = $dbs | Select-Object name,recoveryModel,effectiveSLADomainName,latestRecoveryPoint,id |
Sort-Object name |
Out-GridView -PassThru
$requests = $dbs | ForEach-Object{New-RubrikSnapshot -id $_.id -Inherit -Confirm:$False}
return $requests