powershell
Set the computer name using the BIOS Asset Tag
If you are setting the Asset Tag the same name that the computer is, it makes sense to only have to input it once. I created a powershell script that will do the following:
If VM or Mac: Exit 0
If computer exists in SCCM: Exit 0
If AssetTag Exists/Not empty: Set OSDComputerName to AssetTag, Exit 0
If AssetTag doesn't exist: Bring up an error message, Exit 1
Tested with HP and Dell machines.
Update: Added optional script that uses the HP Ownership Tag
How to use:
Create a package for the script
Copy serviceUI.exe (From MDT Toolkit) to the same folder.
In the Task Sequence after initial format of the drive create a Run Command Line step using the package that you created
with the command: ServiceUI.exe -process:TSProgressUI.exe %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File AssetTag.ps1
Thanks Nickolaj and Dave Green for the initial form
Create a compliance baseline to remove a folder
In this example we are killing the Silverlight start menu folder enabling us to use the Windows Updates while keeping the start menu clean.
Create the Configuration Item
1. In the console click Create Configuration Item
2. Name your configuration item, click 'This configuration item contains application settings' and click Next
3. Select 'Always assume application is installed' and click Next
4. Click New, Change the Setting type to 'Script'. Change the Data type to 'String'. Also name your Setting.
5. Under Discovery Script click 'Add Script'
6. Ensure Script language is 'Windows Powershell' and paste the following
$false -eq (Test-Path "C:ProgramDataMicrosoftWindowsStart MenuProgramsMicrosoft Silverlight")
7. Under Remediation Script click 'Add Script'
8. Ensure Script language is 'Windows Powershell' and paste the following
remove-item "C:ProgramDataMicrosoftWindowsStart MenuProgramsMicrosoft Silverlight" -recurse
9. Click 'Ok', then click the 'Compliance Rules' tab
10. Click 'New'
11. Configure the Compliance rule: Set 'Rule type' to Value. Set the Value returned to equal 0. Click 'Run the specified remediation script when this setting is non complaint'.
12. Click 'OK' then 'Next', 'Next' on the Wizard Screen.
13. Choose the OS Environments for compliance
14. Click 'Next' until you finish the Wizard.
15. Under Configuration Baselines click 'Create Configuration Baseline' and add the configuration item we just created, then click 'OK'
16. The Baseline is now ready to be deployed to your test collection!
Right click and select Deploy, Enable the remediation options and change the Schedule if needed.
17. On your test machine, request a new machine policy, then click on the Components tab. Clicking Refresh should show the new baseline which you can then evaluate.
18. Within a minute the remediation runs and the folder disappears!