locked
Program Files (x86) String Error RRS feed

  • Question

  • Hello there,

    I want to use the script below but it gives (x86) string error.

    $username = "domain\username"
    $password = "password"
    $credentials = New-Object System.Management.Automation.PSCredential -ArgumentList    @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
    Start-Process -FilePath ""C:\Program Files (x86)\Symantec\Symantec Endpoint Protection\Smc" -start"  -Credential ($credentials)

    thank you

    Friday, May 22, 2020 9:09 AM

Answers

  • Hi Jrv,
    but when I type C: \ Program Files instead of C: \ Program Files (x86) the command works

    thanks

    I doubt that.  I suspect you are typing things wrong and we cannot see what you are typing.

    Most of the issue is that you haven't read the help for the command and you have no experience with PowerShell.  Reading the help is the first step after learning basic PowerShell.  Guessing is always the hardest way.

    $paramStartProcess = @{
        FilePath = 'C:\Program Files (x86)\Symantec\Symantec Endpoint Protection\Smc'
        ArgumentList = '-start'
        Credential = $credentials
    }
    
    Start-Process @paramStartProcess


    \_(ツ)_/

    • Marked as answer by tr.sertac Friday, May 22, 2020 1:10 PM
    Friday, May 22, 2020 11:35 AM

All replies

  • YOU cannot combine arguments with the file path.

    Start by reviewing how to use the command.  Look closely at the examples.

    help start-process -online


    \_(ツ)_/

    Friday, May 22, 2020 11:19 AM
  • Hi Jrv,
    but when I type C: \ Program Files instead of C: \ Program Files (x86) the command works

    thanks

    Friday, May 22, 2020 11:31 AM
  • Hi Jrv,
    but when I type C: \ Program Files instead of C: \ Program Files (x86) the command works

    thanks

    I doubt that.  I suspect you are typing things wrong and we cannot see what you are typing.

    Most of the issue is that you haven't read the help for the command and you have no experience with PowerShell.  Reading the help is the first step after learning basic PowerShell.  Guessing is always the hardest way.

    $paramStartProcess = @{
        FilePath = 'C:\Program Files (x86)\Symantec\Symantec Endpoint Protection\Smc'
        ArgumentList = '-start'
        Credential = $credentials
    }
    
    Start-Process @paramStartProcess


    \_(ツ)_/

    • Marked as answer by tr.sertac Friday, May 22, 2020 1:10 PM
    Friday, May 22, 2020 11:35 AM
  • Hi Jrv,

    thank you very much


    • Marked as answer by tr.sertac Wednesday, May 27, 2020 1:43 PM
    • Unmarked as answer by jrv Wednesday, May 27, 2020 4:37 PM
    Friday, May 22, 2020 1:14 PM