Forum Replies Created
May 6, 2020 at 4:46 am in reply to: Converting .bak file format to VHd using Powershell #225876ParticipantTopics: 1Replies: 2Points: -2Rank: Member
So this works to create your backup fine, I assume. Now you are wanting a container with the contents of the backup? Maybe i’m misunderstanding, but wouldn’t you just want to spin up a SQL container, and then restore your backup?
Perhaps you can provide clarity on what exactly you’re intending to do with the VHD. Since it’s a SQL backup file, I imagine you’re wanting to either access the data within or verify it’s integrity.
Thanks for your valuable feedback. the link you provided is used to create the container. but I am stuck to build an image from the .bak file.
I have multiple backups (.bak). I want to build an image for all backups and after using this image file I want to create a windocks container that includes (container name, port, and password). so that I assign the container to a different department in the organization. The steps are : (taking backups > build image>create a windocks container)
I want to automate all these steps using PowerShell.
May 5, 2020 at 4:43 am in reply to: Converting .bak file format to VHd using Powershell #225561ParticipantTopics: 1Replies: 2Points: -2Rank: Member
- This reply was modified 3 months ago by Mian50.
If you show us what you’ve tried and where it’s not working/errors received, then i’m sure we can help you figure it out.
#Get-DbaDiskSpace -ComputerName DESKTOP-RAQK42T
$input = Read-Host -Prompt ‘Enter Directory Name:’
$input1 = Read-Host -Prompt ‘Enter Folder Name:’
New-Item -Path “$input” -Name “$input1” -ItemType “directory”
$Server = ‘DESKTOP-RAQK42T’
$Database = ‘db_airport’
$BackupFolder = “$input” + “$input1\”
#$dt = Get-Date -Format yyyy-mm-dd /*Get today date*/
#$FilePath = “$($BackupFolder)$($Database)_db_$($dt).bak”
$FilePath = “$($BackupFolder)$($Database).bak”
Backup-SqlDatabase -ServerInstance $Server -Database $Database -BackupFile $Filepath
#After taking a backup (.bak) from SQL server 2017 . I am intending to convert or build an image .vhdx (Hard disk image file). Using this .vhdx file i wan to create a container . I am new to powershell and need little help. Thanks