Passing PowerShell Parameters containing spaces in SCCM Current Branch

As part of the pre-caching content for an in-place upgrade it’s a good idea to store the path to the content in the registry if you are not keeping it in the SCCM client cache.

As part of my Windows 10 pre-caching task sequence I download the model specific driver package to my custom location and store the variable in a SCCM task sequence variable %PrestageDriver% (Note you don’t need to add the %) 

Later in the Task Sequence I pass the variable to a simple PowerShell script that reads\writes variables into the registry, however as the models I am using contain spaces in the name e.g. “Lenovo T460” the script treats “Lenovo” as one parameter and “T460” as another.

To get around this you simply wrap the variable inside single quotes ‘%YourVariable%’  both double quotes “” or simply the variable on its own wont work!

You can see it in action below:

 NOTE: If you are using the built-in Download Package step, Config Manager will append a number on the end of each Package, incrementing if you have two names the same e.g. %PrestageDriver01%, %PrestageDriver02%

Leave a Reply

Your email address will not be published. Required fields are marked *