locked
Hyper-V Virtual Machine Backup Utility v4.3 RRS feed

  • Question

  • HI everybody,

    I saw this good script for virtual Machine Backup on https://gallery.technet.microsoft.com/scriptcenter/PowerShell-Hyper-V-Backup-7d444752 with Mike Galvin.

    I have runned the script without any customization, but i got the same Issue like somebody else Jdhuyzer. It requires manual input for the backup variable.Everything else works fine after i put the path for the backup (D:\VM_BACKUP).

    Now i realy want to know How can i put the path in the scrip for automatical run?

    Thank you .

     

    m

    Thursday, March 7, 2019 1:32 PM

Answers

  • I just can echo what James said - please start to learn the basics of Powershell.

    Regardless of that: An image of code is not helpful.

    Regardless of that: that's not how you provide a value for a non mandatory parameter: 

    ....
    Param(
        [parameter(Mandatory=$false)]
        [alias("BackupTo")]
        $Backup = 'D:\VM_Backup',
        [alias("Keep")]
        $History,
    ....


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    • Proposed as answer by jrv Sunday, March 10, 2019 3:11 PM
    • Marked as answer by Faucon_First Sunday, March 10, 2019 3:40 PM
    Sunday, March 10, 2019 3:08 PM

All replies

  • For questions about or issues with gallery scripts you should contact the author.

    https://gallery.technet.microsoft.com/scriptcenter/PowerShell-Hyper-V-Backup-7d444752/view/Discussions#content


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    • Proposed as answer by jrv Thursday, March 7, 2019 1:53 PM
    Thursday, March 7, 2019 1:52 PM
  • Hi BOfH_666,

    Thank you for your advise. but i have already contacted the author without any answer. that's why i've tried to get answer from anybody else who can help me in

    Here is my post : Please help me if you got answer. thank you.


    m

    Thursday, March 7, 2019 2:43 PM
  • Just to be completely sure about that ... you know that you have to provide a path where to store the backup, don't you?

    The parameter -Backup (Alias -BackupTo) is mandatory. Therefore you have to provide a path. If you want to run the script always with the  same path you could save a shortcut or a batch file if you want where you provide the path in the command line or you could change the param block, remove the "mandatory flag" and provide a path for the parameter Backup.

    BTW: Of course it can take some time to get an answer there. I wouldn't expect for the author to answer there in a really short amount of time.


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''


    • Edited by BOfH-666 Friday, March 8, 2019 2:10 AM
    • Proposed as answer by jrv Sunday, March 10, 2019 2:04 PM
    Friday, March 8, 2019 2:07 AM
  • Hi 

    Yes i know that i have to provide a path where to store the backup. 

    By following your advise : " or you could change the param block, remove the "mandatory flag" and provide a path for the parameter Backup." i've removed the mandatory flag and provided a path for the paramter backup. After running the script, this is what i got as an erreur : 


    m

    Sunday, March 10, 2019 1:53 PM
  • I recommend learning basic PowerShell before attempting to use any commands that can make changes to your system. 

    This forum is not really equipped to teach you PowerShell one line at a time.  Your question is the most basic question of simple PowerShell use.


    \_(ツ)_/

    Sunday, March 10, 2019 2:06 PM
  • Allright. i got you thank you. l'll do.

    m

    Sunday, March 10, 2019 3:05 PM
  • I just can echo what James said - please start to learn the basics of Powershell.

    Regardless of that: An image of code is not helpful.

    Regardless of that: that's not how you provide a value for a non mandatory parameter: 

    ....
    Param(
        [parameter(Mandatory=$false)]
        [alias("BackupTo")]
        $Backup = 'D:\VM_Backup',
        [alias("Keep")]
        $History,
    ....


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    • Proposed as answer by jrv Sunday, March 10, 2019 3:11 PM
    • Marked as answer by Faucon_First Sunday, March 10, 2019 3:40 PM
    Sunday, March 10, 2019 3:08 PM
  • Excellent link!


    \_(ツ)_/

    Sunday, March 10, 2019 3:11 PM
  • I  deference to the likely frustration of the OP I can add the following links.  They will give a simple context in a few minutes that can help someone new to programming with PowerShell.  THeydo not teach the basics but do create the context that will make learning the basics easier and, I think, more fun.

    In an interview published 2017 September 13, Jeffrey Snoverexplained the motivation for the project:<sup class="reference" id="cite_ref-11">[11]</sup>

    I'd been driving a bunch of managing changes, and then I originally took the UNIX tools and made them available on Windows, and then it just didn't work. Right? Because there's a core architectural difference between Windows and Linux. On Linux, everything's an ASCII text file, so anything that can manipulate that is a managing tool.  AWK, grep, sed? Happy days!

    I brought those tools available on Windows, and then they didn't help manage Windows because in Windows, everything's an API that returns structured data. So, that didn't help. [...] I came up with this idea of PowerShell, and I said, "Hey, we can do this better."

    From: https://en.wikipedia.org/wiki/PowerShell

    Also: https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-6

    The above will explain what PowerShell is and, more important , why.

    PowerShell is not like any other scripting systems and has some very new and highly sophisticated features.  These features make PowerShell very easy to use once you understand that they exist and how they are implemented.

    Good luck and happy PosH'ing.

    There is one very good video tutorial by the PowerShell Team.  It is scheduled to be removed so get it now.  It can be downloaded and viewed offline but the online version is better presented and organized.

    Getting Started with Microsoft PowerShell


    \_(ツ)_/

    Sunday, March 10, 2019 3:25 PM
  • Hi,

    thank you so much for the advise, and i'am sorry for the image of code. Like you said, i'll got learn the basic of Powershell because I do not really know the language of scripts (powershell). 

    I read in my research of solutions that would allow me to make the automatic backup of my VMs and I came across this script.

    thank you, it's works.

    if you have some links or advise for the basic learning of powershell, i'am intersting. 

    Thank you so much.


    m

    Sunday, March 10, 2019 3:26 PM
  • i got it. thank you so much.

    m

    Sunday, March 10, 2019 3:30 PM
  •  i'll got learn the basic of Powershell because I do not really know the language of scripts (powershell).

    As for being new to PS, this is fine, we've all been there, but it is vital that you get yourself ramped up, to limit / avoid, many misconceptions, confusion, errors, bad habits, etc.. that you are going to encounter.

    There is an excellent source for starters in the Microsoft Virtual Academy - Getting Started with Powershell. You should not wait to long to watch because they are about to close the MVA and move to Microsoft Learning.

    Hav a lot of fun! ;-)


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Sunday, March 10, 2019 3:32 PM
  • Excellent link!


    \_(ツ)_/

    That's what I thought too when I saw this first ... isn't that amazing - sometimes I used to think that there is ABSOLUTELY EVERYTHING already out there in the internet ... you just have to find it.

    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Sunday, March 10, 2019 3:35 PM
  • i understand. thanks a lot.

    m

    Sunday, March 10, 2019 3:40 PM