VirtualEngine / Lability

Virtual Engine test lab deployment and configuration module
MIT License
283 stars 50 forks source link

Setting SecureBoot value per CustomMedia #376

Closed OsaPL closed 5 years ago

OsaPL commented 5 years ago

Hi, the problem I'm facing is that each time my team would want to use a Win7 images you have to set SecureBoot = $false inside Node That means that every, single node would have to use this param which is not ideal (we have a single whole server dedicated to only this task).

Can you somehow set SecureBoot inside CustomMedia? (I've seen Media\CustomData but I don't see any way to set it there)

OsaPL commented 5 years ago

Yeah, just tested and Gen1 is also not working.

iainbrighton commented 5 years ago

Hi @OsaPL - can you post your custom media definition so we can take a look?

OsaPL commented 5 years ago
    Id = 'Windows7TestGen1';
    Filename = 'en_windows_7_professional_with_sp1_x64_dvd_u_676939.iso';
    Architecture = 'x64';
    Uri = 'file://C:\Lability\ISOs\en_windows_7_professional_with_sp1_x64_dvd_u_676939.iso';
    Checksum = '';
    Description = 'Windows 7';
    MediaType = 'ISO';
    ImageName = '1';
    OperatingSystem = 'Windows';
    CustomData = @{
      VmGeneration = 1;
      CustomBootstrap = @(
        '## Unattend.xml will set the Administrator password, but it wont enable the account on client OSes'
        'NET USER Administrator /active:yes;'
        '## This enables guest SMB sessions'
        '$path = "HKLM:\Software\Policies\Microsoft\Windows\LanmanWorkstation"'
        'if(!(Test-Path $path)){'
        'New-Item $path -Force;'
        '}'
        'Set-ItemProperty $path  -Name AllowInsecureGuestAuth -Value 1 -Force'
        'Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell -Name ExecutionPolicy -Value RemoteSigned -Force; #306'
        '## Kick-start PowerShell remoting on clients to permit applying DSC configurations'
        'Enable-PSRemoting -SkipNetworkProfileCheck -Force'
      );
    }
}

Its stuck on "Starting windows..."

EDIT: After mounting the disk manually to check files: -There is no log file present. -Bootstrap.ps1 is there and has the custom payload.

iainbrighton commented 5 years ago

Unfortunately, you can't use Lability to build directly from a Windows 7 ISO (only PowerShell v2.0 and no DSC). You'll need to use a custom SYSPREP'd VHD/WIM with WMF 4 (or later installed) to get it to work. Does this make sense?

OsaPL commented 5 years ago

Yeah, is WMF4 the only prereq for a Lability supported MasterImage?

iainbrighton commented 5 years ago

@OsaPL Yes - there is a recommended hotfix too but you can find the details here

OsaPL commented 5 years ago

Great, seems to work now. Thanks!

The only issue I have left is networking configuration, tried using LegacyNetworking module but to no avail, getting "Access denied." . If you prefer you can close this issue, and I will open another one, regarding this on LegacyNetworking repo.

iainbrighton commented 5 years ago

@OsaPL Yes - please open a new issue with the details of the issues you're facing in the appropriate repository!