Mian50

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Converting .bak file format to VHd using Powershell #225876
    Participant
    Topics: 1
    Replies: 2
    Points: -2
    Rank: 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?

    https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&pivots=cs1-bash

    https://hub.docker.com/_/microsoft-mssql-server

    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.

    For clarity:

    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.

     

    • This reply was modified 3 months ago by Mian50.
    in reply to: Converting .bak file format to VHd using Powershell #225561
    Participant
    Topics: 1
    Replies: 2
    Points: -2
    Rank: Member

    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”
    echo $input
    echo $input1
    # Variable
    $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”

    #For Backup
    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

Viewing 2 posts - 1 through 2 (of 2 total)