powershell - Script runs fine in ISE but fails from Command Prompt -
i have following script:
add-computer -domainname ("a.b.c.d") -credential (new-object system.management.automation.pscredential("a.b.c.d\abcdadmin", (convertto-securestring "1234qwer" -asplaintext -force)))
obviously domain not 'a.b.c.d' follows that. has no special characters or lead me believe cause problems. ise output:
add-computer : cannot add computer '<removed>' domain 'a.b.c.d' because in domain. @ line:1 char:1 + add-computer -domainname ("a.b.c.d") -credential (new-object system. ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invalidoperation: (20012ua95009jz:string) [add-computer], invalidoperationexce ption + fullyqualifiederrorid : addcomputertosamedomain,microsoft.powershell.commands.addcomputercommand
so runs fine in ise (with exception it's in domain), command prompt says otherwise:
at line:1 char:143 + ... fl.us\abcdadmin, (convertto-securestring 1234qwer -asplaintext -force))) + ~ missing argument in parameter list. + categoryinfo : parsererror: (:) [], parentcontainserrorrecordex ception + fullyqualifiederrorid : missingargument
the biggest limitation script must one-line.
Comments
Post a Comment