Search the Community
Showing results for tags 'variable'.
-
OSD Run Command Line: WMI to TS Variable
jHetzer posted a question in Troubleshooting, Tools, Hints and Tips
OSD Run Command Line: WMI to TS Variable (Tested with WinPE 1703 and Windows 10 1703 / SCCM 2012 Version 1706 / MDT ) A short guide how to store WMI information into a Task Sequence Variable without the need of a script. (And therefore without a "Update Distribution Point") Create a new "Run Command Line" Step Set the step name for example: "Set Task Sequence Variable OSD_VariableName" Command Line: powershell -Command "& {(New-Object -COMObject Microsoft.SMS.TSEnvironment).Value('OSD_VariableName') = (Get-WmiObject Win32_ComputerSystemProduct).Version}" Done The example shows how to store the property "Version" of the WMI Class "Win32_ComputerSystemProduct" into the Variable "OSD_VariableName". This is for example usefully for Lenovo devices because the property holds the real model name (Lenovo Model Names) and not the cryptic ID which may change. Other examples would be: Device Disk Count: powershell -Command "& {(New-Object -COMObject Microsoft.SMS.TSEnvironment).Value('OSD_DiskCount') = @(Get-WmiObject -query 'Select * from Win32_DiskDrive WHERE MediaType = \"Fixed hard disk media\"').Count}" Device TPM Chip Available: powershell -Command "& {(New-Object -COMObject Microsoft.SMS.TSEnvironment).Value('OSD_TPMChipAvailable') = [boolean](Get-WmiObject -Namespace 'ROOT\cimv2\Security\MicrosoftTpm' -query 'SELECT * FROM Win32_Tpm')}" Event more complicated commands are possible but at some point a script provides more flexibility. Important Note: "Run Command Line" step in conjunction with "powershell -Command "& {Crazy-PowershellFunction}" has problems with double quotes ("). If they are required they need to be escaped with "\". See for example: Device Disk Count: Other special characters my produce similar issues. If you like this quick and simple solution and found some other useful commands please share them in a reply to this Topic- 1 reply
-
- variable
- tasksequence
-
(and 4 more)
Tagged with:
-
Hi All, Would like to know if there's a way to create a new Status Filter variable (Eg. %msgsys, %msgsrc and etc.) . At the start of the TS, the user who kicked-off the TS requires to authenticate before proceeding. Would like to capture the user's details (email, givenname and sn), store these into a variable (Eg. %email, %givenname & %surname) then pass it to the SCCM Status Filter Rules. Regards, ej
-
- Status Messages
- Task Sequence
- (and 6 more)
-
Collect Variables in Windows Via HTA for Task Sequence
ryman posted a question in Frontends, HTA's and Web Services
I am working with an HTA frontend to collect information from the user and pass this information to the task sequence for the OS build. I started with advertising the task sequence within Windows to the computer. The user launch the advertisement, it gathers some information and the HTA opens for some user input. This all works fine, the issue is when I try to collect my variables with the object ("Microsoft.SMS.TSEnvironment") I get an error. I understand that I can not use this object just within Windows but, it is being launch by the task sequence in the task sequence. Am I missing something? or How do I pass variables from within Windows I need to the task sequence so I can use them during the build? -
====================================================================================================================================================================================== >> Available via download here on the TechNet Galleries! << ====================================================================================================================================================================================== I do have to admit that this tool is already available in it's final form for over a month, but it seemed appropriate to also post here about this final relase. I think this right-click action might be very usefull for most administrators. It also took quite a while before I finally made a 1.0 version of this script/ form. Now it’s there, I also have to admit that I’m even a bit proud of it! It was a nice way of getting familiar with PowerShell and WMI. With answering a few very basic questions, I'll try to provide as much information as possible. What functionalities does it provide?This right-click action shows a lot of detailed information about the collections of which a device is a member and also about the collections that the primary user of a device is a member. A quick overview of all the functionalities comes down to the following information per tab: Tab – General; The Name, Id. Limiting Collection, Last Update and Last Membership Change of the Collections. Tab – Deployments; The Name of the Collections and the Name, Type aand State of the targeted Deployments. Tab – Variables; The Name of the Collections and the Name, Value and Type of the Collection Variable. Tab – Maintenance Windows; The Name of the Collections and the Name, Start Time, Duration, Recurrence, Schedule, Type of the Maintenance Window. Tab – Power Management; The Name of the Collections, the Name of the Non-Peak Power Plan and the Name, Start Time, End Time and Wake-up Time of the devices in the Collection. Tab – Primary User: Tab – General; The Name of the Collections, Id, Limiting Collection, Last Update and the Last Membership Change of the Collections. Tab – Primary User: Tab – Deployments; The Name of the Collections and the Name, Type and State of the targeted Deployments. What does it look like?To show the power and usage of this right-click action, I created the following small movie: Where is it available?The final version of my Collection Details Form is publicly available via the TechNet Galleries and for a direct download, via ShowCollectionDetails_v1_0p.ps1. How can it be used?To use this script as a right-click action, save the script at [sCRIPTLOCATION], make sure that the folder <AdminConsoleInstallDir>\XmlStorage\Extensions\Actions\ed9dee86-eadd-4ac8-82a1-7234a4646e62 and the folder <AdminConsoleInstallDir>\XmlStorage\Extensions\Actions\3fd01cd1-9e01461e-92cd-94866b8d1f39 exist and add a XML file to those folders as specified here: <ActionDescription Class="Group" DisplayName="Custom Actions" MnemonicDisplayName="Custom Actions" Description="Custom Actions" SqmDataPoint="53"> <ShowOn> <string>ContextMenu</string> </ShowOn> <ActionGroups> <ActionDescription Class="Executable" DisplayName="Show Collection Details" MnemonicDisplayName="Show Collection Details" Description="Show Collection Details"> <ShowOn> <string>ContextMenu</string> </ShowOn> <Executable> <FilePath>PowerShell.exe</FilePath> <Parameters>-ExecutionPolicy ByPass -WindowStyle Hidden "[sCRIPTLOCATION]\ShowCollectionDetails_v1_0p.ps1" -ResourceId "##SUB:ResourceId##" -SiteCode "##SUB:SiteCode##" -SiteServer "##SUB:__Server##</Parameters> </Executable> </ActionDescription> </ActionGroups> </ActionDescription> Questions?Please don't hesitate to drop any questions, either here or via my own blog at: www.petervanderwoude.nl
-
- 1
-
- PowerShell
- Collection
- (and 5 more)
-
Hi All, I was wondering if you could help me in renaming PC's during deployment. I am just getting started with SCCM and OSD deployments. I have a basic working deployment that deploys drivers per model using a wmi query to find the model number. My (dell) desktops / laptops will install and join the domain to a specified OU. My problem is when i add the OSDcomputername task sequence variable %serialnumber% i get the following error just before it finishes the task sequence. "Windows could not parse or process the unattend answer file for pass [specialize]. The settings specified in the answer file cannot be applied. The error was detected while processing settings for component [Microsoft-Windows-Shell-Setup]." My task sequence settings have been attached if that helps. Enabled it and it breaks things, disabled it and it goes back to working again. 1) Firstly is this the correct way for automating PC renaming during deployment? 2) What are others doing to rename PC's during deployment? I have read a lot of posts on forums regarding this process including scripts etc but i cannot make any of them work via OSD. I have a working powershell script that i can run from the desktop that checks if the serial number (TAG) matches the computer name, if it does not it renames the computer to the Serial number (TAG). Then i join the domain but i would like this to be part of the task sequence so we dont have to revisit workstations. If anyone has a working solution for renaming PC's during deployment please let me know. Thanks for reading Regards Dave
- 1 reply
-
- task sequence
- osd
-
(and 5 more)
Tagged with:
-
I would like to set custom Variables, at bottom line, I would like to use that in a later step to assign dynamically ip address in the server staging process. So my goal would be, set a computer variable MYVAR = TESTVAR and have that at the end a txt file with the contend TESTVAR. But it looks like I am missing something, any help would be nice. In the computer object I defined in that case MYVAR = TESTVAR: In the TS I call the Variable %MYVAR% and pipe it in a file. checking the smsts.log I can see that the command is executing but not like I mentioned. What I am missing? Thanks for help num63r5
-
Hello All, We are performing LTI with the UDI module. When administrator enters the intended name of the computer we need to get this name (presumably OSDComputerName task sequence variable) and add some text to it. We already got the concatenating portion of the script, but need help with the first part and the third parts. So, basically we need to perform the following sub-tasks: Get the task sequence variable with the intended computer name which was entered by the administrator. Verify/modify it (this portion we already implemented) Set the task sequence variable using the modified computer name. Would you be so kind to advise on the following questions: Should we use the OSDComputerName task sequence variable or any other else? What the code in the PowerShell should be in order to get the input from the administrator and set the new computer name? What is the proper location of this task should be in the task sequence? We prefer to get it before the OS is installed, but would highly appreciate if you provide is with the location. Also, we received the following error: PS C:\Windows\system32> $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment New-Object : Cannot load COM type Microsoft.SMS.TSEnvironment. At line:1 char:20 + $tsenv = New-Object <<<< -COMObject Microsoft.SMS.TSEnvironment + CategoryInfo : InvalidType: ( [New-Object], PSArgumentException + FullyQualifiedErrorId : CannotLoadComObjectType,Microsoft.PowerShell.Commands.NewObjectCommand Thank you very much for your time and help!
-
- SCCM
- PowerShell
-
(and 3 more)
Tagged with:
-
Set Task Sequence Variable to Device Property
mt204 posted a question in Troubleshooting, Tools, Hints and Tips
I'm using MDT Task Sequences with SCCM and am trying to get a proper Computer Description set. It was easy to do with OSDComputerName and check if a computer was already named properly in AD for whether or not a popup would ask for a new name. Now I've tried using the same method for setting the computer description. I've made sure that my Discovery settings includes the Description property, so I can see the AD Description in my Devices properties. The problem is how to set a task sequence variable to use the variable assigned to my device. I thought setting a variable: OSDComputerDesc with a value: %Description% would do it, but that was a bad guess. How do I bring in the Device Property Value and give it to my new TS Variable? -
Hi, We would like to be prompted at the beginning of a Task Sequence to create a local account and has administrator access. I've tried using the following script. set env = CreateObject("Microsoft.SMS.TSEnvironment") EngName = inputbox("Engineer ID" ,"Please enter your Network ID below:",env("_SMSTSengname"),400,0) env("EngName") = EngName I think I might need to define the task sequence variable? If I'm not giving enough information, just let me know.