I've been struggling with this one and need some help. The Get-WmiObject command below returns the DOMAIN\Logged_In_User on a remote computer. I would like an "If Statement" to return "No Logged User" if there are no user logged in on the remote computer.
#Provide Custom Code for events specified in PrimalForms.
$btnStatus_OnClick=
{
#TODO: Place custom script here
$sBar.Text = $txtComputer.Text + ": " + (GetStatus($txtComputer.Text))
$lblRunningAs_DATA.Text = Get-WmiObject -computername $txtComputer.Text -class win32_computersystem | select -ExpandProperty username
}