Just taking a quick glance at how to do it in Powershell and found this:
http://www.potentengineer.com/using-powershell-to-set-osd-task-sequence-variables/
To set the date:
powershell.exe -executionpolicy bypass -command "& {$tsenv = New-Object
-COMObject Microsoft.SMS.TSEnvironment; $tsenv.Value('ImageVersion') = get-date
-uformat %m%d%Y}"
So to set the first two characters to a value called %First2% I’d imagine it
looks something like this:
powershell.exe -executionpolicy bypass -command "& {$tsenv = New-Object
-COMObject Microsoft.SMS.TSEnvironment; $tsenv.Value('First2') =
($tsenv.Value("OSDComputerName").Substring(2))
You’ll definitely want to test it, I don’t have a way to confirm that works
right this moment.
-Matt
From: [email protected] [mailto:[email protected]] On
Behalf Of Murray, Mike
Sent: Thursday, July 31, 2014 9:03 AM
To: [email protected]
Subject: RE: [mssms] Help with task sequence variable logic
Anyone already have a script that does this? Rather not reinvent the wheel. Or
at least a good example?
Thanks,
Mike
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Murray, Mike
Sent: Thursday, July 31, 2014 9:01 AM
To: [email protected]<mailto:[email protected]>
Subject: RE: [mssms] Help with task sequence variable logic
Ah, makes sense. Thanks. :)
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Ryan
Sent: Thursday, July 31, 2014 8:55 AM
To: [email protected]<mailto:[email protected]>
Subject: Re: [mssms] Help with task sequence variable logic
He is talking about a VB script which will take the first two characters of a
computer name and put it in a task sequence variable, like
OSDCompNameStartsWith. Then, you can make the step only run if that task
sequence variable equals QI or RS.
On Thu, Jul 31, 2014 at 10:51 AM, Murray, Mike
<[email protected]<mailto:[email protected]>> wrote:
The task sequence variable is already there. Not sure what you mean here?
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]<mailto:[email protected]>]
On Behalf Of Jason Wallace
Sent: Thursday, July 31, 2014 8:49 AM
To: [email protected]<mailto:[email protected]>
Subject: Re: [mssms] Help with task sequence variable logic
Write a small vbscript to dump the first two characters to a task sequence
variable and then query it
On 31 Jul 2014, at 17:47, "Murray, Mike"
<[email protected]<mailto:[email protected]>> wrote:
I have a couple of steps in our TS that I want to execute for one set of
computers based on their naming convention, and another set of steps for
another set of computers with a different naming convention. The two naming
conventions start with:
QL-
RS-
If I use the argument under options, task sequence variable OSDComputerName
greater than or equal to “QL-%”, both naming conventions match the requirement,
and I don’t want that. If I just use equals, it doesn’t work at all.
Is there some other way to work this logic?
Best Regards,
Mike Murray
Desktop Management Coordinator - IT Support Services
California State University, Chico
530.898.4357<tel:530.898.4357>
[email protected]<mailto:[email protected]>
________________________________
This message is intended for the sole use of the addressee, and may contain
information that is privileged, confidential and exempt from disclosure under
applicable law. If you are not the addressee you are hereby notified that you
may not use, copy, disclose, or distribute to anyone the message or any
information contained in the message. If you have received this message in
error, please immediately advise the sender by reply email and delete this
message.