PSD icon indicating copy to clipboard operation
PSD copied to clipboard

Customsettings.ini subsection evaluation and testing of customsettings.ini

Open DocJelly opened this issue 11 months ago • 2 comments

I'm having some trouble with getting the subsections to work in PSD. I have it working in MDT, and have adapted it to the customsettings.ini in PSD, but it seems like the subsections are not getting evaluated. Are these subsections supported yet in PSD?

[Settings]
Priority=Init,ByVirtual,ByLaptop,ByDesktop,Default
Properties=ComputerAssetNumber,ComputerTypeName,LogUserDomain,LogUserID,LogUserPassword,DriverPath,GenericDriverPath,FallBackDriverPath,PSDWizard,PSDWizardTheme,PSDDebug,MyCustomProperty

[Init]
ComputerAssetNumber=%AssetTag%

[ByVirtual]
Subsection=Virtual-%IsVM%

[ByLaptop]
Subsection=Laptop-%IsLaptop%

[ByDesktop]
Subsection=Desktop-%IsDesktop%

[Virtual-True]
ComputerTypeName=VM

[Laptop-True]
ComputerTypeName=LAP

[Desktop-True]
ComputerTypeName=WS

[Default]
OSInstall=Y
OSDComputerName=PRE%ComputerAssetNumber%%ComputerTypeName%

Using this customsettings, the OSDComputername comes out as PRE1234%ComputerTypeName%

In the psdgather log I can see that the property is added but it's never defined so that makes me think that the ByLaptop section isn't being evaluated at all.

I've also tried: moving the OSDComputerName into the ByLaptop section. This results in a MININT-HHA6AS computername. Adding the ComputerTypeName to the ByLaptop section. This results in EVERY deployment getting a LAP suffix Adding the Laptop-True section to Priority. this also results in every deployment getting a LAP suffix

Second part of my question is, is there a way to test customsettings by running it on the server or in WinPE like this batch file for the old cscript/wsf version so the logs are viewable in CMTrace instead of get-content or notepad during the deployment? Those raw logs are hard on the eyes :)

https://deploymentbunny.com/2011/04/27/quick-and-dirty-testing-customsettings-ini-variables-in-mdt/

DocJelly avatar Feb 05 '25 18:02 DocJelly

In my testing, I see that the subsections are getting processed but not outputting them. However, I'm not sure if this would be a PSDWizardNew module process or a PSDGather.psm1 issue.

I do see the Assettag in the computer name but not the %ComputerTypeName%

Image

For testing these rules, I use an "MDT simulator" that has been modified for PSD. I made some updated to it recently but here is the repo for it. https://github.com/PowerShellCrack/MDTTSSimulator

In testing with these variables, I see it being processed but i don't see it updating the properties. The PSDWizardNew will try but it doesn't see the %ComputerTypeName% in the subsections.

Image

I'm not sure how to proceed other by stating this has not been throughly tested and may not be the best path to go. Keep in mind PSD is NOT MDT.

PowerShellCrack avatar Feb 09 '25 00:02 PowerShellCrack

There is a feature that could work for you but its only if you're using the new PSDWizard. You could add a function (or modify) in the Computer_readiness.ps1 file to account for the chassis types and overwrite the properties.

Image

PowerShellCrack avatar Feb 09 '25 00:02 PowerShellCrack