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

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -