While learning Powershell I am trying to make a script that will prompt me for my Domain Admin account details and then the Hostname that I would like to check to see who is currently logged in and whether the machine is locked/active/logged out/turned off.
I have the below so far, but unable to see why I keep getting errors when testing on my own machine that I do have admin access to,
Any ideas please?
Error I am getting is: "Error browsing Network…."
#Get my domain Admin Account details
$Creds = Get-Credential
#To Query a PC for Current Logged in State
$ComputerName = Read-host "Please enter the Hostname"
#query user /server:$ComputerName -credential $Creds
C:scriptspsloggedon.exe -accepteula \$ComputerName -credential $Creds