CMD Command via Powershell

Welcome Forums General PowerShell Q&A CMD Command via Powershell

This topic contains 3 replies, has 3 voices, and was last updated by

js
 
Participant
3 months, 3 weeks ago.

  • Author
    Posts
  • #103732

    Participant
    Points: 0
    Rank: Member

    I have an agent(KACE) that takes commands to update it via the command line, something like this:

    C:\Program Files (x86)\Quest\KACE>AMPTools.exe host="newhostnamehere"
    

    and

    C:\Program Files (x86)\Quest\KACE>runkbot.exe 4 0
    

    I'm trying to create a PS script to run these and for the life of me, I can't seem to get it.

    Any suggestions?

  • #103733

    Participant
    Points: 4
    Rank: Member

    How about something like this:

    $AMPptions = @('host="newhostnamehere"')
    & 'AMPTools.exe' $AMPptions
    
    $runkbotptions = @('4','0')
    & 'runkbot.exe' $runkbotptions
    
    • #103736

      Participant
      Points: 0
      Rank: Member

      That worked! Thanks a lot!! 🙂

  • #103741
    js

    Participant
    Points: 7
    Rank: Member

    Wouldn't this work as is in Powershell? You lose the double quotes, but I don't think they're needed anyway. I doubt your hostname has a space in it (I don't think that would even matter). Is there a 64-bit Kace client yet, lol?

    AMPTools.exe host="newhostnamehere"
    runkbot.exe 4 0

    If you want the double quotes, you can put single quotes around them, like for the find command:

     echo hi | find '"hi"'

The topic ‘CMD Command via Powershell’ is closed to new replies.