I was wondering if any of you super tallanted scripters can help or atleast offer advise as to why this is not working.
So i have a Powershell script that collects data from the Registry and shows the output ina very simple form at the end of a SCCM deployment. (This for is WIP and i will ament it to show errors later etc… but for now this will only come up if the deployment was good with no errors)
So if i change my Script to show
$Form.WindowState = ‘Maximized’ - It works but the format is all tucked up in the top/left part of the screen. If i change it to
$Form.WindowState = ‘Normal’ or just remove the other command as Normal is default. The system just sits at the pre loading screen and does nothing at all. This is really annoying me so any help would be amazing.
After the Build it runs a boot strapper to load the Powershell Script outside of the Task Sequence
Dim oWS
Set oWS = CreateObject("Wscript.Shell")
Call oWS.Run("%windir%\system32\osdsetuphook.exe /execute", 0 , true)
Call oWS.Run("powershell.exe -ExecutionPolicy Bypass -File %windir%\Temp\OSDReport\Report.ps1", 0 , true)
Wscript.Quit(0)
~~~ Report.ps1 ~~~
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
$Form = New-Object system.Windows.Forms.Form
$Form.text = "Build LAB"
$Form.TopMost = $True
$Form.WindowState = 'Normal'
#$Form.WindowState = 'Maximized'
$Form.Height = 240
$Form.Width = 350
$Form.FormBorderStyle = 'FixedDialog'
$Form.MaximizeBox = $False
$Form.MinimizeBox = $False
$Form.Name = 'Build'
$Form.StartPosition = 'CenterScreen'
$Form.FormBorderStyle = 'FixedDialog'
$Form.controls.AddRange(@($Label1,$Label2,$Label3,$Label4,$Label5,$Label6,$Label7,$Label8,$Label9,$Button1))
$Label1 = New-Object system.Windows.Forms.Label
$Label1.text = "Build Complete"
$Label1.AutoSize = $true
$Label1.width = 25
$Label1.height = 10
$Label1.location = New-Object System.Drawing.Point(88,14)
$Label1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',15,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$Label1.ForeColor = "Green"
$Label2 = New-Object system.Windows.Forms.Label
$Label2.text = "Host Name"
$Label2.AutoSize = $true
$Label2.width = 25
$Label2.height = 10
$Label2.location = New-Object System.Drawing.Point(15,47)
$Label2.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$Label2.ForeColor = "Blue"
$Label3 = New-Object system.Windows.Forms.Label
$Label3.text = Get-ItemPropertyValue -Path HKLM:\SOFTWARE\BuildInfo\ -Name "OSDComputerName"
$Label3.AutoSize = $true
$Label3.width = 25
$Label3.height = 10
$Label3.location = New-Object System.Drawing.Point(158,47)
$Label3.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$Label4 = New-Object system.Windows.Forms.Label
$Label4.text = "Deployment Date"
$Label4.AutoSize = $true
$Label4.width = 25
$Label4.height = 10
$Label4.location = New-Object System.Drawing.Point(15,77)
$Label4.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$Label4.ForeColor = "Blue"
$Label5 = New-Object system.Windows.Forms.Label
$Label5.text = Get-ItemPropertyValue -Path HKLM:\SOFTWARE\BuildInfo\ -Name "DeploymentDate"
$Label5.AutoSize = $true
$Label5.width = 25
$Label5.height = 10
$Label5.location = New-Object System.Drawing.Point(158,77)
$Label5.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$Label6 = New-Object system.Windows.Forms.Label
$Label6.text = "Deployment Duration"
$Label6.AutoSize = $true
$Label6.width = 25
$Label6.height = 10
$Label6.location = New-Object System.Drawing.Point(15,107)
$Label6.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$Label6.ForeColor = "Blue"
$Label7 = New-Object system.Windows.Forms.Label
$Label7.text = Get-ItemPropertyValue -Path HKLM:\SOFTWARE\BuildInfo\ -Name "DeploymentDuration"
$Label7.AutoSize = $true
$Label7.width = 25
$Label7.height = 10
$Label7.location = New-Object System.Drawing.Point(158,107)
$Label7.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$Label8 = New-Object system.Windows.Forms.Label
$Label8.text = "Task Sequence"
$Label8.AutoSize = $true
$Label8.width = 25
$Label8.height = 10
$Label8.location = New-Object System.Drawing.Point(15,137)
$Label8.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$Label8.ForeColor = "Blue"
$Label9 = New-Object system.Windows.Forms.Label
$Label9.text = Get-ItemPropertyValue -Path HKLM:\SOFTWARE\BuildInfo\ -Name "TaskSequenceName"
$Label9.AutoSize = $true
$Label9.width = 25
$Label9.height = 10
$Label9.location = New-Object System.Drawing.Point(157,137)
$Label9.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$Button1 = New-Object system.Windows.Forms.Button
$Button1.text = "Finish"
$Button1.width = 312
$Button1.height = 29
$Button1.location = New-Object System.Drawing.Point(15,160)
$Button1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$Button1.add_Click({$Form.Close()})
[void] $Form.ShowDialog()
Any help would be very greatfully received :) Thanks in advance