Error Using Createsrsmedia ps1, Custom Teams Room Device

  Kiến thức lập trình

Im attempting to use the createsrsmedia.ps1 script provided from Microsoft to make a custom team’s room device for testing purposes before we invest and install a large deployment.

I was able to get most of the way through the script but Im failing out at around line 1462.

Here is the error:

Export-WindowsImage : Either the Name or Index parameter is required
At C:teamscriptCreateSrsMedia.ps1:1462 char:9
+         Export-WindowsImage -DestinationImagePath "$NewInstallWim" -S ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Export-WindowsImage], PSArgumentException
    + FullyQualifiedErrorId : Export-WindowsImage,Microsoft.Dism.Commands.ExportWindowsImageCommand

And here is the script section that is in question:

   # Windows
    Write-Host "Copying Windows... " -NoNewline
    ## Exclude install.wim, since apparently some Windows source media are not USB EFI compatible (?) and have WIMs >4GB in size.
    SyncDirectory -Src $WindowsMedia -Dst $TargetDrive -Flags @("/xf", "install.wim")
    Write-Host "done."

    $NewInstallWim = (Join-Path $PSScriptRoot "install.wim")
    $InstallWimMnt = (Join-Path $PSScriptRoot "com-mnt")
    $SourceName = "Windows $MajorOs Enterprise"

    try {
        Write-Host "Copying the installation image... " -NoNewline
        Export-WindowsImage -DestinationImagePath "$NewInstallWim" -SourceImagePath (Join-Path (Join-Path $WindowsMedia "sources") "install.wim") -SourceName $SourceName | Write-Debug
        Write-Host "done."

        # Image update
        if ($InstallLP.Count -gt 0 -or $InstallLIP.Count -gt 0 -or $InstallUpdates -ne $null) {
            mkdir $InstallWimMnt | Write-Debug
            Write-Host "Mounting the installation image... " -NoNewline
            Mount-WindowsImage -ImagePath "$NewInstallWim" -Path "$InstallWimMnt" -Name $SourceName | Write-Debug
            Write-Host "done."

            Write-Host "Applying language packs... " -NoNewline
            ForEach ($pack in $InstallLP) {
                Add-WindowsPackage -Path "$InstallWimMnt" -PackagePath "$pack" -ErrorAction Stop | Write-Debug
            }
            ForEach ($pack in $InstallLIP) {
                Add-WindowsPackage -Path "$InstallWimMnt" -PackagePath "$pack" -ErrorAction Stop | Write-Debug
            }
            Write-Host "done."

            Write-Host "Applying updates... " -NoNewline
            ForEach ($update in $InstallUpdates) {
                Add-WindowsPackage -Path "$InstallWimMnt" -PackagePath "$update" -ErrorAction Stop | Write-Debug
            }
            Write-Host "done."

            Write-Host ""
            Write-Warning "PLEASE WAIT PATIENTLY"
            Write-Host "This next part can, on some hardware, take multiple hours to complete."
            Write-Host "Aborting at this point will result in NON-FUNCTIONAL MEDIA."
            Write-Host "To minimize wait time, consider hardware improvements:"
            Write-Host "  - Use a higher (single-core) performance CPU"
            Write-Host "  - Use a fast SSD, connected by a fast bus (6Gbps SATA, 8Gbps NVMe, etc.)"
            Write-Host ""

            Write-Host "Cleaning up the installation image... " -NoNewline
            Set-ItemProperty (Join-Path (Join-Path $TargetDrive "sources") "lang.ini") -name IsReadOnly -value $false
            Invoke-Native "& dism /quiet /image:$InstallWimMnt /gen-langini /distribution:$TargetDrive"
            Invoke-Native "& dism /quiet /image:$InstallWimMnt /cleanup-image /startcomponentcleanup /resetbase"
            Write-Host "done."

            Write-Host "Unmounting the installation image... " -NoNewline
            Dismount-WindowsImage -Path $InstallWimMnt -Save | Write-Debug
            rmdir $InstallWimMnt
            Write-Host "done."
        }

        Write-Host "Splitting the installation image... " -NoNewline
        Split-WindowsImage -ImagePath "$NewInstallWim" -SplitImagePath (Join-Path (Join-Path $TargetDrive "sources") "install.swm") -FileSize 2047 | Write-Debug
        del $NewInstallWim
        Write-Host "done."
    } catch {
        try { Dismount-WindowsImage -Path $InstallWimMnt -Discard -ErrorAction SilentlyContinue } catch {}
        del $InstallWimMnt -Force -ErrorAction SilentlyContinue
        del $NewInstallWim -Force -ErrorAction SilentlyContinue
        throw
    }

The second line after try ( is where we are hitting the error.
The iso we are using is enterprise as the script calls for and the install.wim is in wim format and not ESD

We tried using a larger flashdrive as well but that didnt work either.

If anyone has any suggestions on what we can try to resolve this issue, I would really appreciate the assistance!

The iso we are using is enterprise as the script calls for and the install.wim is in wim format and not ESD

We tried using a larger flashdrive as well but that didnt work either.

New contributor

rbeard.js is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT