Jump to content


Search the Community

Showing results for tags 'Powershell OSD'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Cloud
    • Azure
    • Microsoft Intune
    • Office 365
  • General Stuff
    • General Chat
    • Events
    • Site News
    • Windows News
    • Suggestion box
    • Jobs
  • MDT, SMS, SCCM, Current Branch &Technical Preview
    • How do I ?
    • Microsoft Deployment Toolkit (MDT)
    • Official Forum Supporters
    • SMS 2003
    • Configuration Manager 2007
    • Configuration Manager 2012
    • System Center Configuration Manager (Current Branch)
    • Packaging
    • scripting
    • Endpoint Protection
  • Windows Client
    • how do I ?
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows Vista
    • Windows XP
    • windows screenshots
  • Windows Server
    • Active Directory
    • Microsoft SQL Server
    • System Center Operations Manager
    • KMS
    • Windows Deployment Services
    • NAP
    • Failover Clustering
    • PKI
    • Windows Server 2008
    • Windows Server 2012
    • Windows Server 2016
    • Windows Server 2019
    • Hyper V
    • Exchange
    • IIS/apache/web server
    • System Center Data Protection Manager
    • System Center Service Manager
    • System Center App Controller
    • System Center Virtual Machine Manager
    • System Center Orchestrator
    • Lync
    • Application Virtualization
    • Sharepoint
    • WSUS

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 2 results

  1. I am working for a company who is looking to create a new Windows 10 image. I have a powershell script that prompts for a Computer name and this all works fine by passing the OSDComputerName variable to the TS. I'm trying to introduce is another powershell script that will ask the user to select one of 2 domains. This is done by selecting one of 2 radio buttons in a Powershell Form called by a function. Whichever one is selected will create a custom TS variable and the variable will be passed on later to the Task Sequence and the correct Network Settings will be set dependent on which domain is selected. The problem is the Domain Select script doesn't seem to run as part of the TS and it just sits there. The code of the script is shown below -------------------------------------------------------------------------------------------------------------------------------------------- #Disable Task Sequence Progress Screen $tsui = New-Object -COMObject Microsoft.SMS.TSProgressUI $tsui.closeprogressdialog() # A function to create the form function Domain_Form{ [void] [system.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [void] [system.Reflection.Assembly]::LoadWithPartialName("System.Drawing") # Set the size of your form $Form = New-Object System.Windows.Forms.Form $Form.width = 500 $Form.height = 300 $Form.Text = ”Please select domain" # Set the font of the text to be used within the form $Font = New-Object System.Drawing.Font("Times New Roman",12) $Form.Font = $Font # Create a group that will contain your radio buttons $MyGroupBox = New-Object System.Windows.Forms.GroupBox $MyGroupBox.Location = '40,30' $MyGroupBox.size = '400,150' $MyGroupBox.text = "Select PRIMARY or SECONDARY Domain" # Create the collection of radio buttons $RadioButton1 = New-Object System.Windows.Forms.RadioButton $RadioButton1.Location = '20,40' $RadioButton1.size = '350,20' $RadioButton1.Checked = $true $RadioButton1.Text = "PRIMARY" $RadioButton2 = New-Object System.Windows.Forms.RadioButton $RadioButton2.Location = '20,70' $RadioButton2.size = '350,20' $RadioButton2.Checked = $false $RadioButton2.Text = "SECONDARY" #$RadioButton3 = New-Object System.Windows.Forms.RadioButton #$RadioButton3.Location = '20,100' #$RadioButton3.size = '350,20' #$RadioButton3.Checked = $false #$RadioButton3.Text = "??" # Add an OK button # Thanks to J.Vierra for simplifing the use of buttons in forms $OKButton = new-object System.Windows.Forms.Button $OKButton.Location = '130,200' $OKButton.Size = '100,40' $OKButton.Text = 'OK' $OKButton.DialogResult=[system.Windows.Forms.DialogResult]::OK #Add a cancel button $CancelButton = new-object System.Windows.Forms.Button $CancelButton.Location = '255,200' $CancelButton.Size = '100,40' $CancelButton.Text = "Cancel" $CancelButton.DialogResult=[system.Windows.Forms.DialogResult]::Cancel # Add all the Form controls on one line $form.Controls.AddRange(@($MyGroupBox,$OKButton,$CancelButton)) # Add all the GroupBox controls on one line $MyGroupBox.Controls.AddRange(@($Radiobutton1,$RadioButton2,$RadioButton3)) # Assign the Accept and Cancel options in the form to the corresponding buttons $form.AcceptButton = $OKButton $form.CancelButton = $CancelButton # Activate the form $form.Add_Shown({$form.Activate()}) # Get the results from the button click $dialogResult = $form.ShowDialog() # If the OK button is selected if ($dialogResult -eq "OK"){ # Check the current state of each radio button and respond accordingly if ($RadioButton1.Checked){ $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment $tsenv.Value("CustomDomain") = "PRIMARY"} elseif ($RadioButton2.Checked){ $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment $tsenv.Value("CustomDomain") = "SECONDARY"} } } # Call the function Domain_Form -------------------------------------------------------------------------------------------------------------------------------------------- The task sequence progress bar disappears when it's run but thats about it and nothing else ever comes back up. The strange thing is if I run the script in a command prompt manually it runs OK Any help would be appreciated
  2. I am working for a company who is looking to create a new Windows 10 image. I have a powershell script that prompts for a Computer name and this all works fine by passing the OSDComputerName variable to the TS. I'm trying to introduce is another powershell script that will ask the user to select one of 2 domains. This is done by selecting one of 2 radio buttons in a Powershell Form called by a function. Whichever one is selected will create a custom TS variable and the variable will be passed on later to the Task Sequence and the correct Network Settings will be set dependent on which domain is selected. The problem is the Domain Select script doesn't seem to run as part of the TS and it just sits there. The code of the script is shown below -------------------------------------------------------------------------------------------------------------------------------------------- #Disable Task Sequence Progress Screen $tsui = New-Object -COMObject Microsoft.SMS.TSProgressUI $tsui.closeprogressdialog() # A function to create the form function Domain_Form{ [void] [system.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [void] [system.Reflection.Assembly]::LoadWithPartialName("System.Drawing") # Set the size of your form $Form = New-Object System.Windows.Forms.Form $Form.width = 500 $Form.height = 300 $Form.Text = ”Please select domain" # Set the font of the text to be used within the form $Font = New-Object System.Drawing.Font("Times New Roman",12) $Form.Font = $Font # Create a group that will contain your radio buttons $MyGroupBox = New-Object System.Windows.Forms.GroupBox $MyGroupBox.Location = '40,30' $MyGroupBox.size = '400,150' $MyGroupBox.text = "Select PRIMARY or SECONDARY Domain" # Create the collection of radio buttons $RadioButton1 = New-Object System.Windows.Forms.RadioButton $RadioButton1.Location = '20,40' $RadioButton1.size = '350,20' $RadioButton1.Checked = $true $RadioButton1.Text = "PRIMARY" $RadioButton2 = New-Object System.Windows.Forms.RadioButton $RadioButton2.Location = '20,70' $RadioButton2.size = '350,20' $RadioButton2.Checked = $false $RadioButton2.Text = "SECONDARY" #$RadioButton3 = New-Object System.Windows.Forms.RadioButton #$RadioButton3.Location = '20,100' #$RadioButton3.size = '350,20' #$RadioButton3.Checked = $false #$RadioButton3.Text = "??" # Add an OK button # Thanks to J.Vierra for simplifing the use of buttons in forms $OKButton = new-object System.Windows.Forms.Button $OKButton.Location = '130,200' $OKButton.Size = '100,40' $OKButton.Text = 'OK' $OKButton.DialogResult=[system.Windows.Forms.DialogResult]::OK #Add a cancel button $CancelButton = new-object System.Windows.Forms.Button $CancelButton.Location = '255,200' $CancelButton.Size = '100,40' $CancelButton.Text = "Cancel" $CancelButton.DialogResult=[system.Windows.Forms.DialogResult]::Cancel # Add all the Form controls on one line $form.Controls.AddRange(@($MyGroupBox,$OKButton,$CancelButton)) # Add all the GroupBox controls on one line $MyGroupBox.Controls.AddRange(@($Radiobutton1,$RadioButton2,$RadioButton3)) # Assign the Accept and Cancel options in the form to the corresponding buttons $form.AcceptButton = $OKButton $form.CancelButton = $CancelButton # Activate the form $form.Add_Shown({$form.Activate()}) # Get the results from the button click $dialogResult = $form.ShowDialog() # If the OK button is selected if ($dialogResult -eq "OK"){ # Check the current state of each radio button and respond accordingly if ($RadioButton1.Checked){ $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment $tsenv.Value("CustomDomain") = "PRIMARY"} elseif ($RadioButton2.Checked){ $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment $tsenv.Value("CustomDomain") = "SECONDARY"} } } # Call the function Domain_Form -------------------------------------------------------------------------------------------------------------------------------------------- The task sequence progress bar disappears when it's run but thats about it and nothing else ever comes back up. The strange thing is if I run the script in a command prompt manually it runs OK Any help would be appreciated
×
×
  • Create New...