Question About PowerShell and Windows 7 RRS feed

  • Question

  • I am trying to see if there is faster way to get this task done.  I am trying to uninstall and old version system center client.  I am still a beginner with PowerShell.  

    I've been logging into these vdi's and running this command in the cmd c:\windows\ccmsetup\ccmsetup.exe /uninstall 

    That was to uninstall the client.

    I found a way to take care of this through a PSSession, but I still have plenty more to go.

    I tried running this:

     1. Setup a notepad with the list of computers in c:\temp\list.txt

     2. Set variable $ccm=get-content c:\temp\list.txt

     3. Invoke-Command -ComputerName $ccm -ScriptBlock {c:\windows\ccmsetup\ccmsetup.exe /uninstall} 

    It is not running what is in the scriptblock.  Can someone help me with this?


    Thursday, August 10, 2017 6:46 PM


  • Thanks for the response, but I was able to get someone to help me with why it wasn't running what was in the scriptblock.

    Just if you want to know this is what I ended up with:

    Invoke-Command -ComputerName $ccm -ScriptBlock {Start cmd.exe -wait -argument '/c c:\windows\ccmsetup\ccmsetup.exe /uninstall'}

    -We started a command prompt and then ran the command and it worked fine.

    • Marked as answer by dmm51 Friday, August 11, 2017 5:42 PM
    Friday, August 11, 2017 5:42 PM

All replies