vagrant-windows-sysprep 0.0.6 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2df8a8a18113901195e0aa019bc03a77aff26259c8db5e9b6ea6007f52885f51
         | 
| 4 | 
            +
              data.tar.gz: 4c6f69bcee969e681750372b3ead7f0e3018710d57e917a67e393300479fe218
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3715f58719f35db57da04c05ab36cc014ec3aab5bff5f09999e496c3d33d931c628adda47d92b6ad38972ea5a47ea6cc09e10b4cae07b0c6008f82a5960c2090
         | 
| 7 | 
            +
              data.tar.gz: 5ad4390e3af22e74121273c8519bbb9ade57d9737f1661000f03e4861d0472efb584f52ba91e5673ed62ddbc5433a03db552160b4aed0170de337f93b5ba2d9b
         | 
| @@ -63,9 +63,11 @@ module VagrantPlugins | |
| 63 63 | 
             
                        end
         | 
| 64 64 |  | 
| 65 65 | 
             
                        # wait for the machine to be shutdown.
         | 
| 66 | 
            -
                        # NB :poweroff | 
| 67 | 
            -
                        # NB :shutoff | 
| 68 | 
            -
                         | 
| 66 | 
            +
                        # NB :poweroff    is used by the VirtualBox provider.
         | 
| 67 | 
            +
                        # NB :shutoff     is used by the libvirt provider.
         | 
| 68 | 
            +
                        # NB :off         is used by the Hyper-V provider.
         | 
| 69 | 
            +
                        # NB :not_running is used by the VMware Desktop provider.
         | 
| 70 | 
            +
                        until [:poweroff, :shutoff, :off, :not_running].include? @machine.state.id
         | 
| 69 71 | 
             
                          sleep 10
         | 
| 70 72 | 
             
                        end
         | 
| 71 73 |  | 
| @@ -21,6 +21,15 @@ if (!$ComputerName) { | |
| 21 21 | 
             
            $unattendPath = "$PSScriptRoot\vagrant-windows-sysprep-unattend.xml"
         | 
| 22 22 | 
             
            $unattendPs1Path = "$PSScriptRoot\vagrant-windows-sysprep-unattend.ps1"
         | 
| 23 23 |  | 
| 24 | 
            +
            # sysprep renames the user that has the well-known Administrator SID
         | 
| 25 | 
            +
            # to the Administrator name, when $Username has that SID, we must
         | 
| 26 | 
            +
            # rename Administrator back to the $Username name.
         | 
| 27 | 
            +
            # NB this SID always has the format S-1-5-21-<domain>-500.
         | 
| 28 | 
            +
            # see https://support.microsoft.com/en-us/help/243330/well-known-security-identifiers-in-windows-operating-systems
         | 
| 29 | 
            +
            $administratorLocalUser = Get-LocalUser | Where-Object {$_.SID.Value -match '^S-1-5-21-.+-500$'}
         | 
| 30 | 
            +
            $enableAdministrator = $administratorLocalUser.Enabled
         | 
| 31 | 
            +
            $renameAdministratorToUsername = $administratorLocalUser.Name -eq $Username
         | 
| 32 | 
            +
             | 
| 24 33 | 
             
            # NB doing an auto-logon after a sysprep has two effects:
         | 
| 25 34 | 
             
            #    1. make Windows 10 1809 not ask for an account creation (regardless of the
         | 
| 26 35 | 
             
            #       value of SkipUserOOBE/SkipMachineOOBE).
         | 
| @@ -52,12 +61,9 @@ Set-Content ` | |
| 52 61 | 
             
                        -replace '@@COMPUTERNAME@@',$ComputerName `
         | 
| 53 62 | 
             
                        -replace '@@USERNAME@@',$Username `
         | 
| 54 63 | 
             
                        -replace '@@PASSWORD@@',$Password `
         | 
| 55 | 
            -
                        -replace '@@UNATTENDPS1PATH@@',$unattendPs1Path | 
| 64 | 
            +
                        -replace '@@UNATTENDPS1PATH@@',$unattendPs1Path
         | 
| 56 65 | 
             
                )
         | 
| 57 | 
            -
             | 
| 58 | 
            -
                -Encoding UTF8 `
         | 
| 59 | 
            -
                -Path $unattendPs1Path `
         | 
| 60 | 
            -
                -Value @'
         | 
| 66 | 
            +
            $unattendPs1 = @'
         | 
| 61 67 | 
             
            Set-StrictMode -Version Latest
         | 
| 62 68 | 
             
            $ErrorActionPreference = 'Stop'
         | 
| 63 69 | 
             
            $ProgressPreference = 'SilentlyContinue'
         | 
| @@ -82,6 +88,16 @@ WARNING WARNING WARNING WARNING WARNING WARNING | |
| 82 88 |  | 
| 83 89 | 
             
            "@
         | 
| 84 90 |  | 
| 91 | 
            +
            if ($enableAdministrator) {
         | 
| 92 | 
            +
                Get-LocalUser -Name Administrator | Enable-LocalUser
         | 
| 93 | 
            +
            } else {
         | 
| 94 | 
            +
                Get-LocalUser -Name Administrator | Disable-LocalUser
         | 
| 95 | 
            +
            }
         | 
| 96 | 
            +
             | 
| 97 | 
            +
            if ($renameAdministratorToUsername) {
         | 
| 98 | 
            +
                Get-LocalUser -Name Administrator | Rename-LocalUser -NewName $Username
         | 
| 99 | 
            +
            }
         | 
| 100 | 
            +
             | 
| 85 101 | 
             
            Write-Host 'Waiting for WinRM to be running...'
         | 
| 86 102 | 
             
            while ((Get-Service WinRM).Status -ne 'Running') {
         | 
| 87 103 | 
             
                Start-Sleep -Seconds 5
         | 
| @@ -104,7 +120,14 @@ Remove-ItemProperty ` | |
| 104 120 |  | 
| 105 121 | 
             
            Write-Host 'Logging off...'
         | 
| 106 122 | 
             
            logoff
         | 
| 107 | 
            -
            '@
         | 
| 123 | 
            +
            '@ `
         | 
| 124 | 
            +
                -replace '\$enableAdministrator',"$(if ($enableAdministrator) {'$true'} else {'$false'})" `
         | 
| 125 | 
            +
                -replace '\$renameAdministratorToUsername',"$(if ($renameAdministratorToUsername) {'$true'} else {'$false'})" `
         | 
| 126 | 
            +
                -replace '\$Username',"'$Username'"
         | 
| 127 | 
            +
            Set-Content `
         | 
| 128 | 
            +
                -Encoding UTF8 `
         | 
| 129 | 
            +
                -Path $unattendPs1Path `
         | 
| 130 | 
            +
                -Value $unattendPs1
         | 
| 108 131 |  | 
| 109 132 | 
             
            Write-Host 'Syspreping...'
         | 
| 110 133 | 
             
            C:/Windows/System32/Sysprep/sysprep.exe `
         | 
| @@ -41,8 +41,14 @@ | |
| 41 41 | 
             
                                <PlainText>true</PlainText>
         | 
| 42 42 | 
             
                            </Password>
         | 
| 43 43 | 
             
                            <Enabled>true</Enabled>
         | 
| 44 | 
            -
                            <Username | 
| 44 | 
            +
                            <Username>Administrator</Username>
         | 
| 45 45 | 
             
                        </AutoLogon>
         | 
| 46 | 
            +
                        <UserAccounts>
         | 
| 47 | 
            +
                            <AdministratorPassword>
         | 
| 48 | 
            +
                                <Value>@@PASSWORD@@</Value>
         | 
| 49 | 
            +
                                <PlainText>true</PlainText>
         | 
| 50 | 
            +
                            </AdministratorPassword>
         | 
| 51 | 
            +
                        </UserAccounts>
         | 
| 46 52 | 
             
                        <FirstLogonCommands>
         | 
| 47 53 | 
             
                            <SynchronousCommand wcm:action="add">
         | 
| 48 54 | 
             
                                <Order>1</Order>
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: vagrant-windows-sysprep
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.10
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Rui Lopes
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-08-22 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rake
         | 
| @@ -54,8 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 54 54 | 
             
                - !ruby/object:Gem::Version
         | 
| 55 55 | 
             
                  version: '0'
         | 
| 56 56 | 
             
            requirements: []
         | 
| 57 | 
            -
             | 
| 58 | 
            -
            rubygems_version: 2.7.6
         | 
| 57 | 
            +
            rubygems_version: 3.1.2
         | 
| 59 58 | 
             
            signing_key: 
         | 
| 60 59 | 
             
            specification_version: 4
         | 
| 61 60 | 
             
            summary: Vagrant plugin for running Windows sysprep.
         |