Trying to remotely connect to a machine on my network. Found this resource from microsoft. So I tried to rewrite it and I'm getting an error on line 3
$objSWbemLocator = ObjGet("WbemScripting", "SWbemLocator")
ConsoleWrite(@error & @CR)
$objWMIService = $objSWbemLocator.ConnectServer("hostame", "rootcimv2", "domainuser", "password")
ConsoleWrite() returns -2147221020
Is my ObjGet() incorrect for my usage?