Public/Restore-PBRubrikFile.ps1
function Restore-PBRubrikFile { [PoshBot.BotCommand( CommandName = 'rubrik_restorefile', Aliases = 'restorefile' )] [cmdletbinding()] param( [PoshBot.FromConfig()] [parameter(Mandatory)] [hashtable]$Connection, [string]$VM, [string]$FileName, [string]$SnapShot ) $creds = [pscredential]::new($Connection.Username, ($Connection.Password | ConvertTo-SecureString -AsPlainText -Force)) $null = Connect-Rubrik -Server $Connection.Server -Credential $creds $params = $PSBoundParameters $params.Remove('Connection') | Out-Null switch ($type) { 'vm' {$objects = (Get-RubrikVM -id $Id | Get-RubrikSnapshot)[$Snapshot] | New-RubrikMount -PowerOn -Confirm:$false} } $ResponseSplat = @{ Text = Format-PBRubrikObject -Object $objects -FunctionName $MyInvocation.MyCommand.Name AsCode = $true } New-PoshBotTextResponse @ResponseSplat } |