Unpacking Software Livestream

Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Learn More

Chocolatey Product Spotlight

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You'll have a chance to have your questions answered in a live Ask Me Anything format.

Learn More

Chocolatey Coding Livestream

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don't miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Learn More

Calling All Chocolatiers! Whipping Up Windows Automation with Chocolatey Central Management

Webinar from
Wednesday, 17 January 2024

We are delighted to announce the release of Chocolatey Central Management v0.12.0, featuring seamless Deployment Plan creation, time-saving duplications, insightful Group Details, an upgraded Dashboard, bug fixes, user interface polishing, and refined documentation. As an added bonus we'll have members of our Solutions Engineering team on-hand to dive into some interesting ways you can leverage the new features available!

Watch On-Demand
Chocolatey Community Coffee Break

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.

Watch The Replays
Chocolatey and Intune Overview

Webinar Replay from
Wednesday, 30 March 2022

At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Watch On-Demand
Chocolatey For Business. In Azure. In One Click.

Livestream from
Thursday, 9 June 2022

Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Watch On-Demand
The Future of Chocolatey CLI

Livestream from
Thursday, 04 August 2022

Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We'll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Watch On-Demand
Hacktoberfest Tuesdays 2022

Livestreams from
October 2022

For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.

Watch On-Demand

Boxstarter HyperV Module

Downloads:

971,437

Downloads of v 2.9.27:

1,825

Software Author(s):

  • Matt Wrock

Boxstarter HyperV Module

  • 1
  • 2
  • 3

Some Checks Have Failed or Are Not Yet Complete

Not All Tests Have Passed


Validation Testing Passed


Verification Testing Failed

Details

Scan Testing Successful:

No detections found in any package files

Details
WARNING

This package was rejected on 26 Jul 2017. The reviewer chocolatey-ops has listed the following reason(s):

mwrock (maintainer) on 21 Jun 2017 06:37:20 +00:00:

User 'mwrock' (maintainer) submitted package.

chocolatey-ops (reviewer) on 21 Jun 2017 07:10:06 +00:00:

Boxstarter.HyperV has passed automated validation. It may have or may still fail other checks like testing (verification).
NOTE: No required changes that the validator checks have been flagged! It is appreciated if you fix other items, but only Requirements will hold up a package version from approval. A human review could still turn up issues a computer may not easily find.

Guidelines

Guidelines are strong suggestions that improve the quality of a package version. These are considered something to fix for next time to increase the quality of the package. Over time Guidelines can become Requirements. A package version can be approved without addressing Guideline comments but will reduce the quality of the package.

  • The nuspec has been enhanced to allow packageSourceUrl, pointing to the url where the package source resides. This is a strong guideline because it simplifies collaboration. Please add it to the nuspec. More...
  • Summary (summary) is a short explanation of the software. Please include summary in the nuspec. More...
Suggestions

Suggestions are either newly introduced items that will later become Guidelines or items that are don't carry enough weight to become a Guideline. Either way they should be considered. A package version can be approved without addressing Suggestion comments.

  • The nuspec has been enhanced to allow more information related to the software. More... Please consider adding one or more of the following to the nuspec, if available:
    • docsUrl - points to the location of the wiki or docs of the software
    • mailingListUrl - points to the forum or email list group for the software
    • bugTrackerUrl - points to the location where issues and tickets can be accessed
    • projectSourceUrl - points to the location of the underlying software source
Notes

Notes typically flag things for both you and the reviewer to go over. Sometimes this is the use of things that may or may not be necessary given the constraints of what you are trying to do and/or are harder for automation to flag for other reasons. Items found in Notes might be Requirements depending on the context. A package version can be approved without addressing Note comments.

  • The package maintainer field (owners) matches the software author field (authors) in the nuspec. The reviewer will ensure that the package maintainer is also the software author. More...
  • The package id includes dots (.). Usually the package id is separated by '-' instead of dots (except in the case of *.install and *.portable). The reviewer will ensure this is not a new package. More...

chocolatey-ops (reviewer) on 21 Jun 2017 07:16:31 +00:00:

Boxstarter.HyperV has failed automated testing.
This is not the only check that is performed so check the package page to ensure a 'Ready' status.
Please visit https://gist.github.com/87353e0d1fe9b8877192cd7117415441 for details.
The package status will be changed and will be waiting on your next actions.

  • NEW! We have a test environment for you to replicate the testing we do. This can be used at any time to test packages! See https://github.com/chocolatey/chocolatey-test-environment
  • Please log in and leave a review comment if you have questions and/or comments.
  • If you see the verifier needs to rerun testing against the package without resubmitting (a issue in the test results), you can do that on the package page in the review section.
  • If the verifier is incompatible with the package, please log in and leave a review comment if the package needs to bypass testing (e.g. package installs specific drivers).
  • Automated testing can also fail when a package is not completely silent or has pop ups (AutoHotKey can assist - a great example is the VeraCrypt package).
  • A package that cannot be made completely unattended should have the notSilent tag. Note that this must be approved by moderators.

chocolatey-ops (reviewer) on 11 Jul 2017 07:16:48 +00:00:

We've found Boxstarter.HyperV v2.9.27 in a submitted status and waiting for your next actions. It has had no updates for 20 or more days since a reviewer has asked for corrections. Please note that if there is no response or fix of the package within 15 days of this message, this package version will automatically be closed (rejected) due to being stale.

Take action:

  • Log in to the site and respond to the review comments.
  • Resubmit fixes for this version.
  • If the package version is failing automated checks, you can self-reject the package.

If your package is failing automated testing, you can use the chocolatey test environment to manually run the verification and determine what may need to be fixed.

Note: We don't like to see packages automatically rejected. It doesn't mean that we don't value your contributions, just that we can not continue to hold packages versions in a waiting status that have possibly been abandoned. If you don't believe you will be able to fix up this version of the package within 15 days, we strongly urge you to log in to the site and respond to the review comments until you are able to.

chocolatey-ops (reviewer) on 26 Jul 2017 07:20:00 +00:00:

Unfortunately there has not been progress to move Boxstarter.HyperV v2.9.27 towards an approved status within 15 days after the last review message, so we need to close (reject) the package version at this time. If you want to pick this version up and move it towards approval in the future, use the contact site admins link on the package page and we can move it back into a submitted status so you can submit updates.

Status Change - Changed status of package from 'submitted' to 'rejected'.

Description

Boxstarter's HyperV module includes functionality for targeting Hyper-V guest VMs with the ability to automatically configure them for remote installation and to create or restore snapshots at installation time.


tools\setup.ps1
function Install-Boxstarter($here, $ModuleName, $installArgs = "") {
    $boxstarterPath=Join-Path $env:AppData Boxstarter
    if(!(test-Path $boxstarterPath)){
        mkdir $boxstarterPath
    }
    $packagePath=Join-Path $boxstarterPath BuildPackages
    if(!(test-Path $packagePath)){
        mkdir $packagePath
    }    
    foreach($ModulePath in (Get-ChildItem $here | ?{ $_.PSIsContainer })){
        $target=Join-Path $boxstarterPath $modulePath.BaseName
        if(test-Path $target){
            Remove-Item $target -Recurse -Force
        }
    }
    Copy-Item "$here\*" $boxstarterPath -Recurse -Force -Exclude ChocolateyInstall.ps1, Setup.*

    PersistBoxStarterPathToEnvironmentVariable "PSModulePath"
    PersistBoxStarterPathToEnvironmentVariable "Path"
    $binPath =  "$here\..\..\..\bin"
    $boxModule=Get-Module Boxstarter.Chocolatey
    if($boxModule) {
        if($boxModule.Path -like "$env:LOCALAPPDATA\Apps\*") {
            $clickonce=$true
        }
    }
    if(!$clickonce){
        Import-Module "$boxstarterPath\$ModuleName" -DisableNameChecking -Force -ErrorAction SilentlyContinue
    }
    $successMsg = @"
The $ModuleName Module has been copied to $boxstarterPath and added to your Module path. 
You will need to open a new console for the path to be visible.
Use 'Get-Module Boxstarter.* -ListAvailable' to list all Boxstarter Modules.
To list all available Boxstarter Commands, use:
PS:>Import-Module $ModuleName
PS:>Get-Command -Module Boxstarter.*

To find more info visit http://Boxstarter.org or use:
PS:>Import-Module $ModuleName
PS:>Get-Help Boxstarter
"@
    Write-Host $successMsg

    if($ModuleName -eq "Boxstarter.Chocolatey" -and !$env:appdata.StartsWith($env:windir)) {
        $desktop = $([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::DesktopDirectory))
        $startMenu=$("$env:appdata\Microsoft\Windows\Start Menu\Programs\Boxstarter")
        if(!(Test-Path $startMenu)){
            mkdir $startMenu
        }
        $target="powershell.exe"
        $targetArgs="-ExecutionPolicy bypass -NoExit -Command `"&'$boxstarterPath\BoxstarterShell.ps1'`""

		if($installArgs -inotcontains "nodesktopicon") {
			$link = Join-Path $desktop "Boxstarter Shell.lnk"
			Create-Shortcut $link $target $targetArgs $boxstarterPath
		}
        $link = Join-Path $startMenu "Boxstarter Shell.lnk"
        Create-Shortcut $link $target $targetArgs $boxstarterPath

        Set-Content -Path "$binPath\BoxstarterShell.bat" -Force -Value "$target $TargetArgs"
    }
}

function Create-Shortcut($location, $target, $targetArgs, $boxstarterPath) {
    $wshshell = New-Object -ComObject WScript.Shell
    $lnk = $wshshell.CreateShortcut($location)
    $lnk.TargetPath = $target
    $lnk.Arguments = "$targetArgs"
    $lnk.WorkingDirectory = $boxstarterPath
    $lnk.IconLocation="$boxstarterPath\BoxLogo.ico"
    $lnk.Save()

	$tempFile = "$env:temp\TempShortcut.lnk"
		
	$writer = new-object System.IO.FileStream $tempFile, ([System.IO.FileMode]::Create)
	$reader = new-object System.IO.FileStream $location, ([System.IO.FileMode]::Open)
		
	while ($reader.Position -lt $reader.Length)
	{		
		$byte = $reader.ReadByte()
		if ($reader.Position -eq 22) {
			$byte = 34
		}
		$writer.WriteByte($byte)
	}
		
	$reader.Close()
	$writer.Close()
				
	Move-Item -Path $tempFile $location -Force
}
function PersistBoxStarterPathToEnvironmentVariable($variableName){
    $value = [Environment]::GetEnvironmentVariable($variableName, 'User')
    if($value){
        $values=($value -split ';' | ?{ !($_.ToLower() -match "\\boxstarter$")}) -join ';'
        $values+=";$boxstarterPath"
    } 
    elseif($variableName -eq "PSModulePath") {
        $values=[environment]::getfolderpath("mydocuments")
        $values +="\WindowsPowerShell\Modules;$boxstarterPath"
    }
    else {
        $values ="$boxstarterPath"
    }
    if(!$value -or !($values -contains $boxstarterPath)){
        $values = $values.Replace(';;',';')
        [Environment]::SetEnvironmentVariable($variableName, $values, 'User')
        $varValue = Get-Content env:\$variableName
        $varValue += ";$boxstarterPath"
        $varValue = $varValue.Replace(';;',';')
        Set-Content env:\$variableName -value $varValue
    }
}
tools\LICENSE.txt
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.
tools\chocolateyinstall.ps1
$tools = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
. (Join-Path $tools Setup.ps1)
try { 
    $ModuleName = (Get-ChildItem $tools | ?{ $_.PSIsContainer }).BaseName
    $preInstall = Join-Path $tools "$modulename.preinstall.ps1"
    if(Test-Path $preInstall) { .$preInstall }
    Install-Boxstarter $tools $ModuleName $env:chocolateyPackageParameters
} catch {
    write-output $_ | fl * -force
    throw $_.Exception
}
tools\Boxstarter.HyperV\Enable-BoxstarterVM.ps1
function Enable-BoxstarterVM {
<#
.SYNOPSIS
Opens WMI ports and LocalAccountTokenFilterPolicy for Workgroup Hyper-V VMs

.DESCRIPTION
Prepares a Hyper-V VM for Boxstarter Installation. Opening WMI 
ports if remoting is not enabled and enabling 
LocalAccountTokenFilterPolicy if the VM is not in a domain so 
that Boxstarter can later enable PowerShell Remoting.

Enable-BoxstarterVM will also restore the VM to a specified 
checkpoint or create a new checkpoint if the given checkpoint 
does not exist.

.Parameter Provider
The VM Provider to use.

.PARAMETER VMName
The name of the VM to enable.

.PARAMETER Credential
The Credential to use to test PSRemoting.

.PARAMETER CheckpointName
If a Checkpoint exists by this name, it will be restored. Otherwise one will be created.

.NOTES
PSRemoting must be enabled in order for Boxstarter to install to a remote machine. Bare 
Metal machines require a manual step of enabling it before remote Boxstarter installs 
will work. However, on a Hyper-V VM, Boxstarter can manage this by mounting and 
manipulating the VM's VHD. Boxstarter can open the WMI ports which enable it to create a 
Scheduled Task that will enable PSRemoting. For VMs that are not domain joined, 
Boxstarter will also enable LocalAccountTokenFilterPolicy so that local accounts can 
authenticate remotely.

For Non-HyperV VMs, use Enable-BoxstarterVHD to perform these adjustments on the VHD of 
the VM. The VM must be powered off and accessible.

.OUTPUTS
A BoxstarterConnectionConfig that contains the ConnectionURI of the VM Computer and 
the PSCredential needed to authenticate.

.EXAMPLE
$cred=Get-Credential domain\username
Enable-BoxstarterVM -Provider HyperV -VMName MyVM $cred

Prepares MyVM for a Boxstarter Installation

.EXAMPLE
Enable-BoxstarterVM -Provider HyperV -VMName MyVM $cred | Install-BoxstarterPackage MyPackage

Prepares MyVM and then installs MyPackage

.EXAMPLE
Enable-BoxstarterVM -Provider HyperV -VMName MyVM $cred ExistingSnapshot | Install-BoxstarterPackage MyPackage

Prepares MyVM, Restores ExistingSnapshot and then installs MyPackage

.EXAMPLE
Enable-BoxstarterVM -Provider HyperV -VMName MyVM $cred NewSnapshot | Install-BoxstarterPackage MyPackage

Prepares MyVM, Creates a new snapshot named NewSnapshot and then installs MyPackage

.LINK
http://boxstarter.org
Enable-BoxstarterVHD
Install-BoxstarterPackage
#>
    [CmdletBinding()]
    [OutputType([BoxstarterConnectionConfig])]
    param(
        [parameter(Mandatory=$true, ValueFromPipeline=$True, Position=0)]
        [string[]]$VMName,
        [parameter(Mandatory=$true, Position=1)]
        [Management.Automation.PsCredential]$Credential,
        [parameter(Mandatory=$false, Position=2)]
        [string]$CheckpointName
    )
    Begin {
        ##Cannot run remotely unelevated. Look into self elevating
        if(!(Test-Admin)) {
            Write-Error "You must be running as an administrator. Please open a PowerShell console as Administrator and rerun Install-BoxstarperPackage."
            return
        }

        if(!(Get-Command -Name Get-VM -ErrorAction SilentlyContinue)){
            Write-Error "Boxstarter could not find the Hyper-V PowerShell Module installed. This is required for use with Boxstarter.HyperV. Run Install-windowsfeature -name hyper-v -IncludeManagementTools."
            return
        }

        $CurrentVerbosity=$global:VerbosePreference

        if($PSBoundParameters["Verbose"] -eq $true) {
            $global:VerbosePreference="Continue"
        }
    }

    Process {
        $VMName | % { 

            $vm=Get-VM $_ -ErrorAction SilentlyContinue
            if($vm -eq $null){
                throw New-Object -TypeName InvalidOperationException -ArgumentList "Could not find VM: $_"
            }

            if($CheckpointName -ne $null -and $CheckpointName.Length -gt 0){
                $point = Get-VMSnapshot -VMName $_ -Name $CheckpointName -ErrorAction SilentlyContinue
                $origState=$vm.State
                if($point -ne $null) {
                    Restore-VMSnapshot -VMName $_ -Name $CheckpointName -Confirm:$false
                    Write-BoxstarterMessage "$checkpointName restored on $_ waiting to complete..."
                    $restored=$true
                }
            }

            if($vm.State -eq "saved"){
                Remove-VMSavedState $_
            }

            if($vm.State -ne "running"){
                Start-VM $_ -ErrorAction SilentlyContinue
                Wait-HeartBeat $_
            }

            do {
                Start-Sleep -milliseconds 100
                $ComputerName=Get-VMGuestComputerName $_
            } 
            until ($ComputerName -ne $null)
            $clientRemoting = Enable-BoxstarterClientRemoting $ComputerName
            Write-BoxstarterMessage "Testing remoting access on $ComputerName..."
            $remotingTest = Invoke-Command $ComputerName { Get-WmiObject Win32_ComputerSystem } -Credential $Credential -ErrorAction SilentlyContinue
        
            $params=@{}
            if(!$remotingTest) {
                Log-BoxstarterMessage "PowerShell remoting connection failed:"
                if($global:Error.Count -gt 0) { Log-BoxstarterMessage $global:Error[0] }
                write-BoxstarterMessage "Testing WSMAN..."
                $WSManResponse = Test-WSMan $ComputerName -ErrorAction SilentlyContinue
                if($WSManResponse) { 
                    Write-BoxstarterMessage "WSMAN responded. Will not enable WMI." -verbose
                    $params["IgnoreWMI"]=$true
                }
                else {
                    Log-BoxstarterMessage "WSMan connection failed:"
                    if($global:Error.Count -gt 0) { Log-BoxstarterMessage $global:Error[0] }
                    write-BoxstarterMessage "Testing WMI..."
                    $wmiTest=try { Invoke-WmiMethod -ComputerName $ComputerName -Credential $Credential Win32_Process Create -Args "cmd.exe" -ErrorAction SilentlyContinue } catch {$ex=$_}
                    if($wmiTest -or ($ex -ne $null -and $ex.CategoryInfo.Reason -eq "UnauthorizedAccessException")) { 
                        Write-BoxstarterMessage "WMI responded. Will not enable WMI." -verbose
                        $params["IgnoreWMI"]=$true
                    }
                    else {
                        Log-BoxstarterMessage "WMI connection failed:"
                        if($global:Error.Count -gt 0) { Log-BoxstarterMessage $global:Error[0] }
                    }
                }
                $credParts = $Credential.UserName.Split("\\")
                if(($credParts.Count -eq 1 -and $credParts[0] -eq "administrator") -or `
                  ($credParts.Count -eq 2 -and $credParts[0] -eq $ComputerName -and $credParts[1] -eq "administrator") -or`
                  ($credParts.Count -eq 2 -and $credParts[0] -ne $ComputerName)){
                    $params["IgnoreLocalAccountTokenFilterPolicy"]=$true
                }
                if($credParts.Count -eq 2 -and $credParts[0] -eq $ComputerName -and $credParts[1] -eq "administrator"){
                    $params["IgnoreLocalAccountTokenFilterPolicy"]=$true
                }

            }

            if(!$remotingTest -and ($params.Count -lt 2)) { 
                Write-BoxstarterMessage "Stopping $_"
                Stop-VM $_ -WarningAction SilentlyContinue -ErrorAction SilentlyContinue
                $vhd=Get-VMHardDiskDrive -VMName $_
                Enable-BoxstarterVHD $vhd.Path @params | Out-Null
                Start-VM $_
                Write-BoxstarterMessage "Started $_. Waiting for Heartbeat..."
                Wait-HeartBeat $_
            }

            if(!$restored -and $CheckpointName -ne $null -and $CheckpointName.Length -gt 0) {
                Write-BoxstarterMessage "Creating Checkpoint $CheckpointName"
                Checkpoint-VM -Name $_ -SnapshotName $CheckpointName
            }

            $res=new-Object -TypeName BoxstarterConnectionConfig -ArgumentList "http://$($computerName):5985/wsman",$Credential,$null
            return $res
        }
    }

    End {
        $global:VerbosePreference=$CurrentVerbosity
    }
}

function Get-VMGuestComputerName($vmName) {
    $vm = Get-WmiObject -Namespace root\virtualization\v2 -Class Msvm_ComputerSystem -Filter "ElementName='$vmName'"
    $vm.GetRelated("Msvm_KvpExchangeComponent").GuestIntrinsicExchangeItems | % {
        if(([XML]$_) -ne $null){
            $GuestExchangeItemXml = ([XML]$_).SelectSingleNode("/INSTANCE/PROPERTY[@NAME='Name']/VALUE[child::text()='FullyQualifiedDomainName']") 
        
            if ($GuestExchangeItemXml -ne $null) { 
                $GuestExchangeItemXml.SelectSingleNode("/INSTANCE/PROPERTY[@NAME='Data']/VALUE/child::text()").Value 
            }
        }
    }    
}

function Wait-HeartBeat($vmName) {
    do {Start-Sleep -milliseconds 100} 
    until ((Get-VMIntegrationService -VMName $vmName | ?{$_.id.endswith("\\84EAAE65-2F2E-45F5-9BB5-0E857DC8EB47") -or ($_.name -eq "Heartbeat")}).PrimaryStatusDescription -eq "OK")
}
tools\Boxstarter.HyperV\Enable-BoxstarterVHD.ps1
function Enable-BoxstarterVHD {
<#
.SYNOPSIS
Enables WMI and LocalAccountTokenFilterPolicy in a VHD's Windows Registry

.DESCRIPTION
Prepares a VHD for Boxstarter Installation. Opening WMI ports and enabling 
LocalAccountTokenFilterPolicy so that Boxstarter can later enable 
PowerShell Remoting.

.PARAMETER VHDPath
The path to the VHD file

.PARAMETER IgnoreWMI
If specified, WMI ports will not be enabled

.PARAMETER IgnoreLocalAccountTokenFilterPolicy
If specified, IgnoreLocalAccountTokenFilterPolicy will not be enabled

.NOTES
The VHD must be accessible, writable and contain a system drive.

.OUTPUTS
The computer name stored in the VHD's Windows Registry

.EXAMPLE
$ComputerName = Enable-BoxstarterVHD $pathToVHD

Enables IgnoreLocalAccountTokenFilterPolicy and WMI ports in the Windows registry

.EXAMPLE
$ComputerName = Enable-BoxstarterVHD $pathToVHD -IgnoreWMI

Enables IgnoreLocalAccountTokenFilterPolicy in the Windows registry

.EXAMPLE
$ComputerName = Enable-BoxstarterVHD $pathToVHD -IgnoreLocalAccountTokenFilterPolicy

Enables WMI ports in the Windows registry

.LINK
http://boxstarter.org

#>
    [CmdletBinding()]
    param(
        [Parameter(Position=0,Mandatory=$true)]
        [ValidateScript({Test-Path $_})]
        [ValidatePattern("\.(a)?vhd(x)?$")]
        [string]$VHDPath,
        [switch]$IgnoreWMI,
        [switch]$IgnoreLocalAccountTokenFilterPolicy
    )
    $CurrentVerbosity=$global:VerbosePreference
    try {

        if($PSBoundParameters["Verbose"] -eq $true) {
            $global:VerbosePreference="Continue"
        }

        if(!(Get-Command -Name Get-VM -ErrorAction SilentlyContinue)){
            Write-Error "Boxstarter could not find the Hyper-V PowerShell Module installed. This is required for use with Boxstarter.HyperV. Run Install-windowsfeature -name hyper-v -IncludeManagementTools."
            return
        }

        if((Get-ItemProperty $VHDPath -Name IsReadOnly).IsReadOnly){
            throw New-Object -TypeName InvalidOperationException -ArgumentList "The VHD is Read-Only"
        }    
        $before = (Get-Volume).DriveLetter | ? { $_ -ne $null }
        mount-vhd $VHDPath
        $after = (Get-Volume).DriveLetter | ? { $_ -ne $null }
        $winVolume = compare $before $after -Passthru
        Write-BoxstarterMessage "Drives added after mount are $($winVolume)" -Verbose
        $winVolume | % { new-PSDrive -Name $_ -PSProvider FileSystem -Root "$($_):\" -ErrorAction SilentlyContinue | out-null}
        try{
            $sysVolume = $winVolume | ? {Test-Path "$($_):\windows\System32\config"}
            if($sysVolume -eq $null){
                throw New-Object -TypeName InvalidOperationException -ArgumentList "The VHD does not contain system volume"
            }    
            Write-BoxstarterMessage "Mounted $VHDPath with system volume to Drive $($sysVolume)"
            if(!$IgnoreLocalAccountTokenFilterPolicy) {
                reg load HKLM\VHDSOFTWARE "$($sysVolume):\windows\system32\config\software" | out-null
                $policyResult = reg add HKLM\VHDSOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
                Write-BoxstarterMessage "Enabled LocalAccountTokenFilterPolicy with result: $policyResult"
            }

            reg load HKLM\VHDSYS "$($sysVolume):\windows\system32\config\system" | out-null
            $current=Get-CurrentControlSet
            $computerName = (Get-ItemProperty "HKLM:\VHDSYS\ControlSet00$current\Control\ComputerName\ComputerName" -Name ComputerName).ComputerName

            if(!$IgnoreWMI){
                (Get-Item (Get-FireWallKey)).Property | ? { $_-like 'wmi-*' } | % { Enable-FireWallRule $_}
                Write-BoxstarterMessage "Enabled WMI Firewall Rules."
            }

            return "$computerName"
        }
        finally{
            [GC]::Collect() # The next line will fail without this since handles to the loaded hive have not yet been collected
            reg unload HKLM\VHDSOFTWARE 2>&1 | out-null
            reg unload HKLM\VHDSYS 2>&1 | out-null
            Write-BoxstarterMessage "VHD Registry Unloaded" -Verbose
            Dismount-VHD $VHDPath
            Write-BoxstarterMessage "VHD Dismounted"
        }
    }
    finally{
        $global:VerbosePreference=$CurrentVerbosity
    }
}

function Enable-FireWallRule($ruleName){
    $key=Get-FirewallKey
    $rules = Get-ItemProperty $key
    $rule=$rules.$ruleName
    $newVal = $rule.Replace("|Active=FALSE|","|Active=TRUE|")
    Set-ItemProperty $key -Name $ruleName -Value $newVal
    Write-BoxstarterMessage "Changed $ruleName firewall rule to: $newVal" -Verbose
}

function Disable-FireWallRule($ruleName){
    $key=Get-FirewallKey
    $rules = Get-ItemProperty $key
    $rule=$rules.$ruleName
    $newVal = $rule.Replace("|Active=TRUE|","|Active=FALSE|")
    Set-ItemProperty $key -Name $ruleName -Value $newVal
    Write-BoxstarterMessage "Changed $ruleName firewall rule to: $newVal" -Verbose
}

function Get-FireWallKey{
    $current = Get-CurrentControlSet
    return "HKLM:\VHDSYS\ControlSet00$current\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules"
}

function Get-CurrentControlSet {
    return (Get-ItemProperty "HKLM:\VHDSYS\Select" -Name Current).Current

}
tools\Boxstarter.HyperV\Boxstarter.HyperV.pssproj
 
tools\Boxstarter.HyperV\BoxStarter.HyperV.psm1
$unNormalized=(Get-Item "$PSScriptRoot\..\Boxstarter.Chocolatey\Boxstarter.Chocolatey.psd1")
Import-Module $unNormalized.FullName -global -DisableNameChecking -Force
Resolve-Path $PSScriptRoot\*-*.ps1 | 
    % { . $_.ProviderPath }

Export-ModuleMember Enable-BoxstarterVM, Enable-BoxstarterVHD
tools\Boxstarter.HyperV\Boxstarter.HyperV.psd1
@{
Description = 'Provides Cmdlets that will install a Boxstarter package on a Hyper-V VM'
# Script module or binary module file associated with this manifest.
ModuleToProcess = './boxstarter.HyperV.psm1'

# Version number of this module.
ModuleVersion = '2.9.27'

# ID used to uniquely identify this module
GUID = 'bbdb3e8b-9daf-4c00-a553-4f3f88fb6e58'

# Author of this module
Author = 'Matt Wrock'

# Copyright statement for this module
Copyright = '(c) 2017 Matt Wrock'

# Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '3.0'

# Minimum version of the .NET Framework required by this module
DotNetFrameworkVersion = '4.0'

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
NestedModules = @('..\Boxstarter.Common\Boxstarter.Common.psd1','..\Boxstarter.Chocolatey\Boxstarter.Chocolatey.psd1')

# Functions to export from this module
FunctionsToExport = '*'

# Cmdlets to export from this module
CmdletsToExport = '*'

# Variables to export from this module
VariablesToExport = '*'

# Aliases to export from this module
AliasesToExport = '*'

# List of all modules packaged with this module.
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess
PrivateData = '3e9916ed22217c36fe8c20d2e10878ff6f6ba9dd'

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}


Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status
Boxstarter HyperV Module 3.0.2 34325 Monday, June 12, 2023 Approved
Boxstarter HyperV Module 3.0.1 3986 Tuesday, June 6, 2023 Approved
Boxstarter HyperV Module 3.0.0 90352 Thursday, July 14, 2022 Approved
Boxstarter HyperV Module 3.0.0-beta-20220427-21 123 Wednesday, April 27, 2022 Exempted
Boxstarter HyperV Module 2.13.0 150899 Thursday, October 15, 2020 Approved
Boxstarter HyperV Module 2.12.0 383632 Tuesday, October 30, 2018 Approved
Boxstarter HyperV Module 2.11.0 63665 Wednesday, May 16, 2018 Approved
Boxstarter HyperV Module 2.10.3 51192 Thursday, August 31, 2017 Approved
Boxstarter HyperV Module 2.9.26 5158 Monday, June 19, 2017 Approved
Boxstarter HyperV Module 2.9.24 783 Sunday, June 18, 2017 Approved
Boxstarter HyperV Module 2.9.14 6737 Friday, May 5, 2017 Approved
Boxstarter HyperV Module 2.9.5 4650 Thursday, March 30, 2017 Approved
Boxstarter HyperV Module 2.9.2 1138 Monday, March 27, 2017 Approved
Boxstarter HyperV Module 2.8.29 30199 Sunday, May 22, 2016 Approved
Boxstarter HyperV Module 2.8.27 415 Sunday, May 22, 2016 Approved
Boxstarter HyperV Module 2.8.21 1025 Thursday, April 28, 2016 Approved
Boxstarter HyperV Module 2.8.18 680 Tuesday, April 26, 2016 Approved
Boxstarter HyperV Module 2.8.12 1161 Thursday, April 21, 2016 Approved
Boxstarter HyperV Module 2.8.0 1134 Friday, April 15, 2016 Approved
Boxstarter HyperV Module 2.7.0 1983 Sunday, April 3, 2016 Approved
Boxstarter HyperV Module 2.6.41 3521 Sunday, February 28, 2016 Approved
Boxstarter HyperV Module 2.6.25 6349 Friday, December 18, 2015 Approved
Boxstarter HyperV Module 2.6.20 546 Thursday, December 17, 2015 Approved
Boxstarter HyperV Module 2.6.16 714 Tuesday, December 15, 2015 Approved
Boxstarter HyperV Module 2.6.2 694 Monday, December 14, 2015 Approved
Boxstarter HyperV Module 2.6.0 504 Sunday, December 13, 2015 Approved
Boxstarter HyperV Module 2.5.21 8581 Thursday, August 13, 2015 Approved
Boxstarter HyperV Module 2.5.19 1944 Sunday, July 26, 2015 Approved
Boxstarter HyperV Module 2.5.10 1755 Friday, July 10, 2015 Approved
Boxstarter HyperV Module 2.5.3 1318 Wednesday, July 1, 2015 Approved
Boxstarter HyperV Module 2.5.1 545 Wednesday, July 1, 2015 Approved
Boxstarter HyperV Module 2.4.209 4373 Sunday, April 26, 2015 Approved
Boxstarter HyperV Module 2.4.205 2045 Sunday, April 5, 2015 Approved
Boxstarter HyperV Module 2.4.196 1471 Friday, March 20, 2015 Approved
Boxstarter HyperV Module 2.4.188 1349 Monday, March 9, 2015 Approved
Boxstarter HyperV Module 2.4.183 845 Wednesday, March 4, 2015 Approved
Boxstarter HyperV Module 2.4.180 569 Tuesday, March 3, 2015 Approved
Boxstarter HyperV Module 2.4.179 512 Tuesday, March 3, 2015 Approved
Boxstarter HyperV Module 2.4.159 2769 Sunday, January 18, 2015 Approved
Boxstarter HyperV Module 2.4.157 686 Thursday, January 15, 2015 Approved
Boxstarter HyperV Module 2.4.152 833 Monday, January 12, 2015 Approved
Boxstarter HyperV Module 2.4.149 1395 Friday, December 26, 2014 Approved
Boxstarter HyperV Module 2.4.146 482 Friday, December 26, 2014 Approved
Boxstarter HyperV Module 2.4.128 2015 Thursday, November 27, 2014 Approved
Boxstarter HyperV Module 2.4.123 3881 Wednesday, September 24, 2014 Approved
Boxstarter HyperV Module 2.4.110 854 Wednesday, September 17, 2014 Approved
Boxstarter HyperV Module 2.4.93 775 Friday, September 12, 2014 Approved
Boxstarter HyperV Module 2.4.88 1047 Wednesday, September 3, 2014 Approved
Boxstarter HyperV Module 2.4.87 469 Wednesday, September 3, 2014 Approved
Boxstarter HyperV Module 2.4.80 2774 Monday, August 4, 2014 Approved
Boxstarter HyperV Module 2.4.76 550 Sunday, August 3, 2014 Approved
Boxstarter HyperV Module 2.4.70 706 Thursday, July 31, 2014 Approved
Boxstarter HyperV Module 2.4.67 736 Wednesday, July 30, 2014 Approved
Boxstarter HyperV Module 2.4.61 714 Monday, July 28, 2014 Approved
Boxstarter HyperV Module 2.4.57 502 Sunday, July 27, 2014 Approved
Boxstarter HyperV Module 2.4.54 751 Wednesday, July 23, 2014 Approved
Boxstarter HyperV Module 2.4.53 508 Wednesday, July 23, 2014 Approved
Boxstarter HyperV Module 2.4.51 494 Wednesday, July 23, 2014 Approved
Boxstarter HyperV Module 2.4.48 573 Tuesday, July 22, 2014 Approved
Boxstarter HyperV Module 2.4.46 615 Saturday, July 19, 2014 Approved
Boxstarter HyperV Module 2.4.41 704 Sunday, July 13, 2014 Approved
Boxstarter HyperV Module 2.4.39 527 Sunday, July 13, 2014 Approved
Boxstarter HyperV Module 2.4.38 457 Saturday, July 12, 2014 Approved
Boxstarter HyperV Module 2.4.35 495 Saturday, July 12, 2014 Approved
Boxstarter HyperV Module 2.4.32 505 Friday, July 11, 2014 Approved
Boxstarter HyperV Module 2.4.29 1265 Friday, July 4, 2014 Approved
Boxstarter HyperV Module 2.4.26 1027 Monday, June 23, 2014 Approved
Boxstarter HyperV Module 2.4.15 3022 Sunday, April 20, 2014 Approved
Boxstarter HyperV Module 2.4.12 515 Saturday, April 19, 2014 Approved
Boxstarter HyperV Module 2.4.4 797 Saturday, April 5, 2014 Approved
Boxstarter HyperV Module 2.4.0 491 Friday, April 4, 2014 Approved
Boxstarter HyperV Module 2.3.24 1881 Saturday, February 1, 2014 Approved
Boxstarter HyperV Module 2.3.15 599 Monday, January 27, 2014 Approved
Boxstarter HyperV Module 2.3.13 573 Saturday, January 25, 2014 Approved
Boxstarter HyperV Module 2.3.8 543 Thursday, January 23, 2014 Approved
Boxstarter HyperV Module 2.3.0 587 Monday, January 20, 2014 Approved
Boxstarter HyperV Module 2.2.78 691 Thursday, January 9, 2014 Approved
Boxstarter HyperV Module 2.2.59 788 Sunday, December 29, 2013 Approved
Boxstarter HyperV Module 2.2.23 862 Saturday, December 14, 2013 Approved
Boxstarter HyperV Module 2.2.16 492 Friday, December 13, 2013 Approved
Boxstarter HyperV Module 2.2.15 499 Friday, December 13, 2013 Approved
Boxstarter HyperV Module 2.2.12 516 Friday, December 13, 2013 Approved
BoxStarter HyperV Module 2.2.0 540 Thursday, December 12, 2013 Approved

  • Fix for missing AlphaFS.dll
  • Update vendored chocolatey to stable 0.10.7
  • Update vendored chocolatey to stable 0.10.5
  • Add required tags element to boxstarter.common nuspec
  • Fix Set-ExplorerOption argument names
  • Fix Nuspec dependencies to be exact
  • Update vendored chocolatey to stable 0.10.4
  • Randomize package names generated from script to avoid file locks
  • Update vendored Chocolatey to 0.10.4 beta
  • Add Icon toggling of task bar notifications in Set-TaskbarOptions
  • Fix registry key name in Set-TaskbarOptions on some Windows 10 versions
  • Fix Default of RebootOk in boxstarter shell
  • Stop powershell profile loading when in powershell v2
Discussion for the Boxstarter HyperV Module Package

Ground Rules:

  • This discussion is only about Boxstarter HyperV Module and the Boxstarter HyperV Module package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or Boxstarter HyperV Module, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus