True to form, as soon as I ask for help I stumble upon the solution.
What has to happen is that you use the Get-CMWinPEOptionalCompontentInfo to
pull the component info to pass to the Set-CMBootImage command.
Again, I want to add WinPE-HTA.
Start with this command:
Get-CMWinPEOptionalComponentInfo -Architecture X86 -LanguageId 1033 -Name
winpe-hta
PS DV1:\> Get-CMWinPEOptionalComponentInfo -Architecture X86 -LanguageId 1033
-Name winpe-hta
SmsProviderObjectPath :
SMS_WinPEOptionalComponentInfo.LanguageID=1033,UniqueID=10
Architecture : x86
DependentComponentNames : {WinPE-HTA}
DependentIds : {0}
IsRequired : False
LanguageID : 1033
Name : WinPE-HTA
RelativePath : en-us\WinPE-HTA_en-us.cab
Size : 16176034
UniqueID : 10
It provides all the info for that component.
So, to add this components you could do something like this:
$HTML = (Get-CMWinPEOptionalComponentInfo -Architecture X86 -LanguageId 1033
-Name winpe-hta)
Set-CMBootImage -Name "Test Boot Image 2" -AddOptionalComponent $HTML
That's how you do it.
For the record, I said I didn't know how the original 4 default components
matched up...
"Scripting (WinPE-Scripting)" - UniqueID 18
"Startup (WinPE-SecureStartup)" - UniqueID 19
"Network (WinPE-WDS-Tools)" - UniqueID 24
"Scripting (WinPE-WMI)" - UniqueID 26
Thanks
Mike
From: [email protected] [mailto:[email protected]] On
Behalf Of Marable, Mike
Sent: Thursday, March 24, 2016 8:37 AM
To: [email protected]; [email protected]
Subject: [MDT-OSD] Problem with Set-CMBootImage -AddOptionalComponent
Good morning.
I'm writing a PowerShell script to automate setting up boot images in SCCM
(1511) and I have everything working great up to trying to add some optional
components.
When I use: Get-CMBootImage -Name "Test Boot Image"
I get this result:
OptionalComponents : {18, 19, 24, 26}
This translates to "Scripting (WinPE-Scripting)", "Startup
(WinPE-SecureStartup)", "Network (WinPE-WDS-Tools)", and "Scripting
(WinPE-WMI)". How they line up I don't know.
I want to add "HTML (WinPE-HTA)" for example. That is number 10 (I added it
manually and used the Get-CMBootImage command above to get the results).
OptionalComponents : {10, 18, 19, 24...}
I try: Set-CMBootImage -Name "Test Boot Image 2" -AddOptionalComponent 10
But that fails.
Set-CMBootImage : Cannot bind parameter 'AddOptionalComponent'. Cannot convert
the "10" value of type "System.Int32" to type
"Microsoft.ConfigurationManagement.ManagementProvider.IResultObject".
How is this parameter supposed to work? I cannot find any examples of it
anywhere or documentation on how it is supposed to be used. How do I "cast"
the values I need as
"Microsoft.ConfigurationManagement.ManagementProvider.IResultObject"?
Thanks
Mike Marable
Microsoft Systems Engineer Lead
Enterprise Device Engineering and Management
MCPS, MCITP, MCTS, MCSA, MCSE, MS
[Profile<http://www.mycertprofile.com/Profile/5319166625>]
[Blog<http://thesystemsmonkey.wordpress.com/>]
----------------------------------------------------
"It is better to be prepared for an opportunity and not have one than to have
an opportunity and not be prepared."
- Whitney Young, Jr.
"To do anything worthwhile in life you have got to be hungry."
- Les Brown
**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be
used for urgent or sensitive issues
**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be
used for urgent or sensitive issues