Danie Posted April 12, 2016 Report post Posted April 12, 2016 Hello Windows-Noob Folks, Followed this topic https://www.windows-noob.com/forums/topic/11797-using-powershell-to-apply-task-sequence-variables/ To add the description in AD Computer. What I have done defined as below, 1. Created Powershell Script #Create OSD Task Sequence Environment Object $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment #Get the ComputerDescription $strComputerDesc = $tsenv.Value("OSDComputerDesc") #Computer Name $strName = $env:computername #Get PSSession Credentials $strUser = "domain\user" $strPassword = "passw0rd" #Connect to Remote PowerShell Session #Set Active Directory Properties $pw = ConvertTo-SecureString -AsPlainText -Force -String $strPassword $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "$strUser", $pw $s = New-PSSession -Computer SERVER -Credential $cred Invoke-Command -Session $s -Script { Import-Module ActiveDirectory } Invoke-Command -Session $s -ScriptBlock { Set-ADComputer -Identity "$using:strname" -Description "$using:strComputerDesc" } 2. Created a Package (Not Program) and uploaded to DP 3. Now, How do I adds this in Task Sequence?? At first, I added as Run PowerShell Script but it won't worked out. Second do I run as Run Command Line and add these line in TS CMD.EXE /C %SYSTEMDRIVE%\windows\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -file .\ADpowershell.ps1 What is the preferred way to do this? Thank you. Quote Share this post Link to post Share on other sites More sharing options...
Hello Windows-Noob Folks,
Followed this topic
https://www.windows-noob.com/forums/topic/11797-using-powershell-to-apply-task-sequence-variables/
To add the description in AD Computer. What I have done defined as below,
1. Created Powershell Script
Share this post
Link to post
Share on other sites