Code:
$Applications = (Get-WmiObject -Namespace "root\ccm\clientSDK" -Class CCM_SoftwareUpdate -ComputerName $Computer | Sort-Object name)
if ([string]::IsNullOrEmpty($Applications))
{
write-host "$computer,No Pending updates found." -ForegroundColor Yellow;
$textbox1.Text = "No pending updates found."
}
Code:
PS Studio 5.8.247.0
Server 2022 21h2
I keep getting text errors from both a label and a text box similar to this:
ERROR: The property 'Text' cannot be found on this object. Verify that the property exists and can be set.
I looked over several different topics with similar issues and it may be something related to the scope of the script, but my understanding was this the script runs in a global scope. However, I did have to set up a $script:variableName in order for another variable to pass along the relevant details. I validated I am using the correct syntax with this basic one liner in the $formMain_Load section:
$textbox1.Text = "Status"
From that point it never updates with new $textbox1.Text data. Here's a small snippet in a $buttonLoad_Click event:
$Applications = (Get-WmiObject -Namespace "root\ccm\clientSDK" -Class CCM_SoftwareUpdate -ComputerName $Computer | Sort-Object name)
if ([string]::IsNullOrEmpty($Applications))
{
write-host "$computer,No Pending updates found." -ForegroundColor Yellow;
$textbox1.Text = "No pending updates found."
}
Then I get this message:
ERROR: The property 'Text' cannot be found on this object. Verify that the property exists and can be set.
ERROR: + CategoryInfo : InvalidOperation: (:) [], RuntimeException
ERROR: + FullyQualifiedErrorId : PropertyNotFound
ERROR: + PSComputerName : lhl385737
ERROR:
Hopefully I am used PS studio correctly and have this syntax in the right spot. If not, please enlighten me.
Thanks very much, good people.[Codebox=text file=Untitled.txt]
Statistics: Posted by budder1975 — Wed Jul 31, 2024 8:20 am