Hello PowerShell Experts,
I have the following code in a PowerShell script.
###########################################################
HEADER IMAGE
###########################################################
$Img1 = [system.drawing.image]::FromFile(“.\images\001.png”)
$PictureBox1 = New-Object Windows.Forms.PictureBox
$PictureBox1.Location = New-Object System.Drawing.Size(0,0)
$PictureBox1.Size = New-Object System.Drawing.Size(1200,400)
$PictureBox1.Image = $Img1
When I execute it via ISE - I get an error, the form loads but the image doesn’t
Exception calling “FromFile” with “1” argument(s): “.\images\001.png”
Oddly if I open a cmd window, navigate to the forms directory, run PowerShell and execute it from there it loads fine – ever come across this type of thing before?
What I don’t want is the form to error during a “deployment” of it via SCCM if that makes sense.
Regards, Darren