mirror of
https://github.com/MicrosoftDocs/windows-itpro-docs.git
synced 2025-06-17 03:13:44 +00:00
MDT code block standardization plus style updates
This commit is contained in:
@ -9,7 +9,7 @@ ms.localizationpriority: medium
|
||||
author: frankroj
|
||||
ms.topic: article
|
||||
ms.technology: itpro-deploy
|
||||
ms.date: 10/28/2022
|
||||
ms.date: 11/28/2022
|
||||
---
|
||||
|
||||
# Configure MDT for UserExit scripts
|
||||
@ -20,7 +20,7 @@ In this article, you'll learn how to configure the MDT rules engine to use a Use
|
||||
|
||||
You can call a UserExit by referencing the script in your rules. Then you can configure a property to be set to the result of a function of the VBScript. In this example, we have a VBScript named Setname.vbs (provided in the book sample files, in the UserExit folder).
|
||||
|
||||
```
|
||||
```ini
|
||||
[Settings]
|
||||
Priority=Default
|
||||
[Default]
|
||||
@ -35,7 +35,7 @@ The UserExit=Setname.vbs calls the script and then assigns the computer name to
|
||||
|
||||
The Setname.vbs script takes the MAC Address passed from the rules. The script then does some string manipulation to add a prefix (PC) and remove the semicolons from the MAC Address.
|
||||
|
||||
```
|
||||
```vb
|
||||
Function UserExit(sType, sWhen, sDetail, bSkip)
|
||||
UserExit = Success
|
||||
End Function
|
||||
@ -48,23 +48,18 @@ Function SetName(sMac)
|
||||
SetName = "PC" & re.Replace(sMac, "")
|
||||
End Function
|
||||
```
|
||||
|
||||
The first three lines of the script make up a header that all UserExit scripts have. The interesting part is the lines between Function and End Function. Those lines add a prefix (PC), remove the colons from the MAC Address, and return the value to the rules by setting the SetName value.
|
||||
|
||||
>[!NOTE]
|
||||
>The purpose of this sample isn't to recommend that you use the MAC Address as a base for computer naming, but to show you how to take a variable from MDT, pass it to an external script, make some changes to it, and then return the new value to the deployment process.
|
||||
|
||||
> [!NOTE]
|
||||
> The purpose of this sample isn't to recommend that you use the MAC Address as a base for computer naming, but to show you how to take a variable from MDT, pass it to an external script, make some changes to it, and then return the new value to the deployment process.
|
||||
|
||||
## Related articles
|
||||
|
||||
[Set up MDT for BitLocker](set-up-mdt-for-bitlocker.md)
|
||||
|
||||
[Configure MDT deployment share rules](configure-mdt-deployment-share-rules.md)
|
||||
|
||||
[Simulate a Windows 10 deployment in a test environment](simulate-a-windows-10-deployment-in-a-test-environment.md)
|
||||
|
||||
[Use the MDT database to stage Windows 10 deployment information](use-the-mdt-database-to-stage-windows-10-deployment-information.md)
|
||||
|
||||
[Assign applications using roles in MDT](assign-applications-using-roles-in-mdt.md)
|
||||
|
||||
[Use web services in MDT](use-web-services-in-mdt.md)
|
||||
|
||||
[Use Orchestrator runbooks with MDT](use-orchestrator-runbooks-with-mdt.md)
|
||||
- [Set up MDT for BitLocker](set-up-mdt-for-bitlocker.md)
|
||||
- [Configure MDT deployment share rules](configure-mdt-deployment-share-rules.md)
|
||||
- [Simulate a Windows 10 deployment in a test environment](simulate-a-windows-10-deployment-in-a-test-environment.md)
|
||||
- [Use the MDT database to stage Windows 10 deployment information](use-the-mdt-database-to-stage-windows-10-deployment-information.md)
|
||||
- [Assign applications using roles in MDT](assign-applications-using-roles-in-mdt.md)
|
||||
- [Use web services in MDT](use-web-services-in-mdt.md)
|
||||
- [Use Orchestrator runbooks with MDT](use-orchestrator-runbooks-with-mdt.md)
|
||||
|
Reference in New Issue
Block a user