This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
script:powershell:mdt [2020/10/26 18:11] admin created |
script:powershell:mdt [2023/06/12 14:50] (current) admin |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== PowerShell et MDT ====== | ||
+ | |||
+ | ===== Utiliser les variables de MDT ===== | ||
+ | |||
<sxh powershell> | <sxh powershell> | ||
# Get the TS variables | # Get the TS variables | ||
Line 6: | Line 10: | ||
#Copy Item from Deployroot | #Copy Item from Deployroot | ||
Copy-Item "$DeployRoot\Scripts\This.exe" -Destination "C:\Scripts" | Copy-Item "$DeployRoot\Scripts\This.exe" -Destination "C:\Scripts" | ||
+ | </sxh> | ||
+ | |||
+ | ===== Récupérer le mot de passe dans Unattend.xml ===== | ||
+ | <sxh powershell> | ||
+ | # Recovery XML Password | ||
+ | $StringPassword = '' | ||
+ | $sPassword=[System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($StringPassword)) | ||
+ | $sPassword=[System.Text.RegularExpressions.Regex]::Replace($sPassword ,"AdministratorPassword$","") | ||
+ | write-host $sPassword | ||
</sxh> | </sxh> |