Capture input and save into TS variable?

I have a PowerShell script that will prompt the user to enter some information.   I can run this PS script within my task sequence but how to I capture what was entered and save it into a task sequence variable?
mqh7

Hi
I suspect that your UserID variable isn´t passed on to your TS.
You could try this small PowerShell GUI as a workaround.
Insert the code into an empty Notepad document and save it as GetUserID.ps1
Create a package (with no program) in ConfigMgr 2012 using this file as the source.
Insert either a Run Command Line or Run PowerShell Script
step in your TS right after your last partition step in your UDI TS.
The TS variable name used in the script is UserID
I haven´t tested the script but it should Work.
<#
.NOTES
Windows Forms generated by: PowerShell Studio 2014 v4.1.60
Generated on: 11-06-2014 21:51
Generated by: Michael Buchardt
.DESCRIPTION
Get User ID from input and passes it to TS
#>
#region Application Functions
#endregion Application Functions
# Generated Form Function
function Call-GetuserID_psf {
#region Import the Assemblies
[void][reflection.assembly]::Load('mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][reflection.assembly]::Load('System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][reflection.assembly]::Load('System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies
#region Generated Form Objects
[System.Windows.Forms.Application]::EnableVisualStyles()
$Blog = New-Object 'System.Windows.Forms.Form'
$buttonRunOSDeployment = New-Object 'System.Windows.Forms.Button'
$textbox1 = New-Object 'System.Windows.Forms.TextBox'
$labelPleaseEnterAUserID = New-Object 'System.Windows.Forms.Label'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
#endregion Generated Form Objects
# User Generated Script
$OnLoadFormEvent={
#Hide the task sequence progress dialog until next step
$TSProgressUI = new-object -comobject Microsoft.SMS.TSProgressUI
$TSProgressUI.CloseProgressDialog()
$labelPleaseEnterAUserID_Click={
$buttonRunOSDeployment_Click={
#Get User ID from input
$UserID = $textbox1.Text
#Send User ID to SCCM TS
$tsenv = New-Object -ComObject Microsoft.SMS.TSEnvironment
$tsenv.Value("UserID") = "$UserID"
#Close form and Exit Script when RunOSDeployButton is clicked
$Blog.Close()
# --End User Generated Script--
#region Generated Events
$Form_StateCorrection_Load=
#Correct the initial state of the form to prevent the .Net maximized form issue
$Blog.WindowState = $InitialFormWindowState
$Form_Cleanup_FormClosed=
#Remove all event handlers from the controls
try
$buttonRunOSDeployment.remove_Click($buttonRunOSDeployment_Click)
$labelPleaseEnterAUserID.remove_Click($labelPleaseEnterAUserID_Click)
$Blog.remove_Load($OnLoadFormEvent)
$Blog.remove_Load($Form_StateCorrection_Load)
$Blog.remove_FormClosed($Form_Cleanup_FormClosed)
catch [Exception]
#endregion Generated Events
#region Generated Form Code
$Blog.SuspendLayout()
# Blog
$Blog.Controls.Add($buttonRunOSDeployment)
$Blog.Controls.Add($textbox1)
$Blog.Controls.Add($labelPleaseEnterAUserID)
$Blog.AcceptButton = $buttonRunOSDeployment
$Blog.ClientSize = '364, 181'
$Blog.ControlBox = $False
$Blog.Font = "Microsoft Sans Serif, 12pt"
$Blog.KeyPreview = $True
$Blog.MaximizeBox = $False
$Blog.MinimizeBox = $False
$Blog.Name = "Blog"
$Blog.ShowIcon = $False
$Blog.StartPosition = 'CenterScreen'
$Blog.Text = "Get User ID"
$Blog.add_Load($OnLoadFormEvent)
# buttonRunOSDeployment
$buttonRunOSDeployment.Font = "Microsoft Sans Serif, 14pt, style=Bold"
$buttonRunOSDeployment.ForeColor = 'MenuHighlight'
$buttonRunOSDeployment.Location = '97, 98'
$buttonRunOSDeployment.Name = "buttonRunOSDeployment"
$buttonRunOSDeployment.Size = '167, 68'
$buttonRunOSDeployment.TabIndex = 2
$buttonRunOSDeployment.Text = "Run OS deployment"
$buttonRunOSDeployment.UseVisualStyleBackColor = $True
$buttonRunOSDeployment.add_Click($buttonRunOSDeployment_Click)
# textbox1
$textbox1.AcceptsReturn = $True
$textbox1.Font = "Microsoft Sans Serif, 14pt"
$textbox1.Location = '97, 46'
$textbox1.MaxLength = 15
$textbox1.Name = "textbox1"
$textbox1.Size = '167, 29'
$textbox1.TabIndex = 1
# labelPleaseEnterAUserID
$labelPleaseEnterAUserID.Font = "Microsoft Sans Serif, 16pt, style=Bold"
$labelPleaseEnterAUserID.Location = '54, 9'
$labelPleaseEnterAUserID.Name = "labelPleaseEnterAUserID"
$labelPleaseEnterAUserID.Size = '252, 34'
$labelPleaseEnterAUserID.TabIndex = 0
$labelPleaseEnterAUserID.Text = "Please enter a user ID"
$labelPleaseEnterAUserID.add_Click($labelPleaseEnterAUserID_Click)
$Blog.ResumeLayout()
#endregion Generated Form Code
#Save the initial state of the form
$InitialFormWindowState = $Blog.WindowState
#Init the OnLoad event to correct the initial state of the form
$Blog.add_Load($Form_StateCorrection_Load)
#Clean up the control events
$Blog.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
return $Blog.ShowDialog()
} #End Function
#Call the form
Call-GetuserID_psf | Out-Null

Similar Messages

  • HT4059 When I have a PDF that I want to open and save into iBooks - it will attempt to open it and the shelf flips around to make room for it. But it doesn't save it. I have to end up opening it in Adobe or Kindle app to view & save it.

    When I have a PDF that I want to open and save into iBooks - it will attempt to open it and the shelf flips around to make room for it. But it doesn't save it. I have to end up opening it in Adobe or Kindle app to view &amp; save it. This has been doing this awhile, what's wrong. Should
    I take it and have it looked at?

    is there any important stuff saved to your emails? if so you could log on to your emails from a seperate device and back them up. im not sure what else you could do :/

  • How to scan with capture image and save 10.6.8

    how to scan with capture image and save 10.6.8 ?

    Instructions for using Image Capture for this available via the 2nd section.
    http://support.apple.com/kb/HT2502

  • Convert  Script output into PDF and save into Unix Directory

    Hi,
      I had Sales Order Acknowledgement Output and wants to converted to PDFs and then these PDFs to be placed in Unix Directory
    on their way to Docs Library.
    I am using the following code
      CALL FUNCTION 'CLOSE_FORM'
        IMPORTING
          RESULT   = itcpp
        TABLES
          otfdata  = lt_otf  " OTF Data
        EXCEPTIONS
          unopened = 1
          OTHERS   = 2.
    After this form ,  table ltf_otf is empty, So i am not converting into PDF .
    So i need the logic to convert to PDF , and most importantly logic to save into UNIX Directory.
    Thanks

    Hi,
    If you are using the Function Module "OPEN_FORM" to open the form for printing then in this function module there is an IMPORTING parameter OPTIONS which is of type ITCPO to this parameter "OPTIONS-TDGETOTF" needs to be passed as 'X' which will give you the OTF output in the FM "CLOSE_FORM".
    After this call the FM "CONVERT_OTF" and pass the FORMAT as "PDF" which will give you the PDF output in LINES table Parameter. Most important please pass some dummy variable to BIN_FILESIZE variable.
    Now by using OPEN DATASET file name FOR OUTPUT IN BINARY MODE and the LOOP the PDF table and use the TRANSFER statement to place the data in the UNIX File and then Finally use the CLOSE DATASET file name.
    Hope will help to address your issue.
    Regards,
    SRinivas

  • Capturing oracle error codes into a variable

    Hi
    Can someone show me how it is possible to save an Oracle defined error code into a variable? What I am trying to do is when a stored procedure fails an Oracle error is raised, such as ORA-xxxx, then pass this code into variable to be saved into a log.
    How do I achieve this?

    user633278 wrote:
    How do I achieve this?Function SQLCODE in PL/SQL exception handler returns error code. SQLERRM returns message:
    SQL> declare
      2      x number;
      3  begin
      4      x := 1/0;
      5    exception
      6      when others
      7        then
      8          dbms_output.put_line('Error code: ' || SQLCODE);
      9          dbms_output.put_line('Error message: ' || SQLERRM);
    10  end;
    11  /
    Error code: -1476
    Error message: ORA-01476: divisor is equal to zero
    PL/SQL procedure successfully completed.
    SQL> SY.

  • How to read the input field value into ABAP variable?

    Hi All,
    i need a read the value of an input field into an ABAP variable,and i am doing this in the following way
    lstring = request->get_form_field('myFlag').
    here 'myFlag' is the input field name,but this is not returning me any value into lstring.
    I have gone through the SDN and tried to do this.
    could you please help me out to resolve this issue.
    Thanks in Advance,
    Praveena

    Dear Praveena
    In which event are you putting this code. Place it in oninputprocessing event(Page with flow logic Model of coding). Then it will surely work.
    Regards
    Vijay.M

  • Password input and save WiFi Settings

    Hi @all,
    I've got 2 Q's:
    #1: Is there another way to enter the WiFi password, other than with the remote? My WiFi pwd is 64 characters long including special chars. Hence, entering this pwd with the remote is a bit cumbersome.
    #2: how do I save different WiFi settings on AppleTV (second gen)? when I switch known networks, I've to re-enter the pwds. The iPhone or OS X saves those settings - how can I instruct AppleTV to do that?
    i tried to configure AppleTV using iTunes or AirPort Utility, but I could not connect to ATV...
    TIA,
    JC

    capaho wrote:
    i guess the only time this would be needed is if you take the appletv to different locations on a regular basis.
    the reason for my 2 different networks: I connected all my devices to the first one and the other one is a MiFi hotspot w/ access to the internet. I don't have DSL, and for my browsing needs 3G is fast enough even for renting movies from iTunes. Although I could "merge" the 2 WiFi into one, I'd like to keep them separate; especially as the "work WiFi" has much longer password and I don't want to punch that into ATV using the remote
    Thanx @all for the help, I appreciate it! JC

  • Capturing Screen and save it as JPG

    I'm making an exe with flash that will go on CD and what I
    need is to capture the screen so the user can save the image and
    send it by email. I've seen that you can capture an image using php
    but my project will go on CD. Is it possible or I should explain
    the user how to printScreen on Windows...
    Thanks!
    Marta

    If you just want to capture what is on the entire Flash stage
    then you can use the Bitmap class in Flash 8. If you are trying to
    capture items outside of Flash then the answer is no, unless you
    find a third-party tool to use.
    Tim

  • Screen Capture //draw and save image

    I've made a mini flash app that lets you draw/etc...
    I want to be able to take a screen shot of that image, i dont
    want to capture webcame / microphone or anything, just simple
    screen capture...

    You can try with free screen capture softwares like :
    UScreen Capture
    VHScreen Capture
    Camtasia
    Also there are many device which can do this like Vision RGB, Epiphan etc.
    These devices gets listed in FMLE as anyother normal video device. For audio you van attach any mike on your computers and can use the sound card of your system in audio device list.
    These devices lets you capture HD video at maximum 10 FPS depending upon your machine hardware capabilities but i think this FPS is more tha sufficient for power point slides and presentations.
    Also please keep bitrates little bit high because of high size video.
    Please let me know if this works for you.

  • Re: capture screen and save  to any format.

    check out
    http://java.sun.com/products/java-media/jmf/2.1.1/solutions/ScreenGrabber.html

    Try the JMF Solution, Transcode.java
    java Transcode -o capture.avi -v RGB -e 10 vfw://0
    Geo

  • CONCATENATE date and time into a text variable

    Hi ABAP Gurus,
      I would like to retrieve current system date and time and concatenate into a variable. I would really appreciate if someone could help me. I have the following code and i seem to get some kind of error.
    I would like my output to be like:
         "22.JUN.2006  Some Text  12:30:22"
    Code:
    data:  emtext     like TEMSG-EMTEXT.
    data:  date_output(50)  TYPE C.
        CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
           EXPORTING
               INPUT          =  SY-DATUM
           IMPORTING
                OUTPUT        =  date_output.
    SHIFT date_output RIGHT DELETING TRAILING SPACE.
      CONCATENATE date_output ': Some Custom Message '
       INTO emtext.
      Also, is there a function to convert time to text or conversion is not necessary?
    Thanks.
    Regards,
    bw_newbie

    Here is something a little closer to your requirement.
    report zrich_0001 .
    data: date(20) type c,
          time(10) type c,
          str type string.
    data: xT247 type T247.
    select Single * into xt247 from t247
              where MNR = sy-datum+4(2).
    concatenate  sy-datum+6(2) xt247-ktx sy-datum(4)
              INTO date separated by '.'.
    write sy-uzeit to time.
    concatenate date 'SomeText' time into str separated by space.
    write:/ str.
    Regards,
    Rich Heilman

  • How to take data from HTML Template into BSP Variable?

    hi all,
                can we take the data from the input field of HTML Template and collect into BSP variable? i have the shown the HTML Template into BSP page by passing the url in <IFRAME> tag now i have to take the data form the into field of HTML Template and save it back to the BSP table onclicking the Save button of BSP Page. please help me out thanks in advance.
    Thanks & Regards,
    Amol

    Hi Amol,
    This is very simple....
    In the onInputProcessing event of the page use the following code to read data from the InputField into an ABAP variable...
    Then you can use it at will..!
    Code is :
    data : event       TYPE REF TO if_htmlb_data,
           but_event   TYPE REF TO cl_htmlb_event_button.
    event = cl_htmlb_manager=>get_event( request ).
    IF event->EVENT_NAME = 'button' and event->EVENT_TYPE = 'click'.
          but_event ?= event.
          CASE event->EVENT_ID.
            when 'your_button_id'.
              data : lw_inf type ref to cl_htmlb_inputfield.
                 lw_inf ?= cl_htmlb_manager=>get_data(
                                request = runtime->server->request
                                name    = 'inputField'
                                id      = 'your_inputField_id'  ).
              if lw_inf->value is not initial.
                lw_variable = lw_inf->value.
              endif.
         ENDCASE.
    ENDIF.

  • Adobe air with flex, file new, open and save for Desktop software program

    I already have a headache from all the searching. I cannot believe this to be such a confusing topic as every software program we create must be able to save user input, right.
    Here is the problem:
    Novel writing software program Main window has tabnavigator with four navigatorcontent pages 1. characters, 2. worlds, 3. objects, 4. Editor
    Each navigatorcontent page has user input fields in the form of textinput component, textarea component, richtexteditor component, etc.
    problem 1:
    The user needs to be able to open a new project and give it a name and state where it must be saved. All user input in the Novel writing software program must be attached to the file name the user specified - cannot give sample code cause I don't even know where to start looking anymore.
    Problem 2:
    If the user has now defined a new project name, all his input from the different input components has to be compiled into a single file that can be saved. (Dan Pichelman gave me a satisfactory answer on using the file.borwseforsave funtion.) That makes sense, but I first need to get all the user input into that single file. I was convinced that it must be an xml file and that there would be a guide on how to do this but...
    Problem 3:
    This brings me to another problem. All the pages I've researched so  far tell me how to load data from an xml file into a component, but not how to write the text from the component into the xml file. And this xml file cannot be the prefs file in the storage directory, it has to be named by the user and then after filling in all his text in the different tabs of the software, must be saved in this xml file and saved where the user chooses.
    Problem 4:
    now that the user put in his text and it is written to an xml file that he has named and set the path to, he goes on vacation and in two weeks opens his saved file to work on his project again. All the data that was stored in the xml must now be written back into the different user input components so he can continue working on his project, truth be told, there are some samles and tutorials on this subject, but again from only a single page perspective not a multiple tab perspective.
    Problem 5:
    Now the user has deleted and/or changed some text he put in when he started, he wrote some more text in the textareas and texteditor and he clicks the file - save button. The xml file or whatever needs to be used must be updated and saved with all the changes overwriting the old file.
    Problem 6:
    The data entered by the user will end up being a book of say 400 pages. This data will obviously be mostly in the richtexteditor component, so whatever method of saving is used, database or xml or whatever, needs to be able to contain all this data.
    Thought, if you are working with for instance, microsoft powerpoint, it has multiple pages all containing different user inputs and when you click flie - save, it saves all that input into one file. When I as a user opens that saved file it loads all that content back into its place and I can change and manipulate the input and save it again. I would have thought this would be one of the first things adobe or any other software would teach as this is what sofware programs are all about. But alas, the tutorials on this subject for adobe air for Desktop application is extreeeeemely rare.
    My promise is, if someone can help me with this or there is a tutorial out there that covers this properly I  will write a tutorial on this for other newbies as I progress step by step.  
    Pleeeeeeease help this ignorant novice
    Regards

    to save a file you would do something like:
    FileWriter fw = new FileWriter( fileName );
    textComponent.write( fw );
    fw.close();See the JFileChoose API for filtering files by extension. The API gives an example.

  • "Open . . ." and "Save as . . ." crash applications

    Ever since the latest round of software updates were installed on my computer a couple weeks ago (a security update and one other update) I've had a problem with the "Open . . ." and "Save As . . ." options in any application. The problem seems to occur anytime an application tries to open a window with a file browser (Finder windows appear to be unaffected). The program hangs for a few seconds and then crashes. I've sent a couple of crash reports to Apple in the past few days.
    The crashes are reported in system.log. They all include the following:
    kernel[0]: disk0s3: I/O error.
    Furthermore, when I look at the application-specific crash logs I find the following in all of them:
    Exception: EXCBADACCESS (0x0001)
    Code[0]: 0x0000000a
    Code[1]: 0x93e20fa4
    If anyone can offer any help it would be greatly appreciated. Thanks!

    Vartiala wrote:
    Is it possible that PSE keeps in mind that I "always" like to open from "A" and save into "B",
    without changing everytime the directory name?
    No.
    The FileOpen and FileSave dialog windows are Windows system dialog windows.  The remembered last-used directory is common to both.
    Ken

  • "Browse", "open", and "save as" often broken.

    Often when I'm in an application and I choose to browse for a file, no finder window comes up. This also happens sometimes when attempting to "save as". This behaviour persists until I quit or force quit the program. I can save already open documents, but only when quitting.
    This problem is not application specific. This happens with all of the Adobe Suite, Cinema 4D, Microsoft Office, etc. and does not happen with any programs that have a built in file browser. Has anybody experienced this before?

    Vartiala wrote:
    Is it possible that PSE keeps in mind that I "always" like to open from "A" and save into "B",
    without changing everytime the directory name?
    No.
    The FileOpen and FileSave dialog windows are Windows system dialog windows.  The remembered last-used directory is common to both.
    Ken

Maybe you are looking for