Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Uninstall Chrome - Per User Package - Failed

I get the following error when running the Uninstall Chrome package provided by the Admin Arsenal Team.   Any Suggestions?  I get this same error 13 machines when I ran it to try and remove chrome. 

 

You must provide a value expression on the right-hand side of the '-' operator.
At C:\Windows\AdminArsenal\PDQDeployRunner\service-1\exec\Google Chrome - Unins
tall per-user.ps1:28 char:20
+ IF ($item.SID - <<<< in $UnloadedHives.SID) {
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : ExpectedValueExpression

0

Comments

16 comments
Date Votes
  • On one of the machines that errors out can you open powershell and post the output of running $PSVersionTable?

    0

  • Name Value
    ---- -----
    CLRVersion 2.0.50727.5485
    BuildVersion 6.1.7601.17514
    PSVersion 2.0
    WSManStackVersion 2.0
    PSCompatibleVersions {1.0, 2.0}
    SerializationVersion 1.1.0.1
    PSRemotingProtocolVersion 2.1

     

     

    0
  • I've tested the ps1 file on 3 machines, all three of which return clean output, but "Google Chrome not found", and then the profile name it looked for. Exactly what it is supposed to do by looking at the code, however, I have Google Chrome installed on every machine that I tested, so I was expecting a removal to happen, not a "Not found" type message.

    0
  • Are you comfortable with modiifying the PS1 file from them? If you are, please try this:

    Import the package into your packages instead of doing an auto-deployment from the package library.

    Run Powershell ISE as Administrator, browse to and open the .ps1 file.

    On line 28 of that file change the code FROM:

    IF ($item.SID -in $UnloadedHives.SID)

    TO:

    IF ($UnloadedHives.SID -contains $item.SID)

    0
  • Thank You.  I have modified the file.  Just have to wait a couple minutes for it to replicate across my DFS so I can test it.

    0
  • Got a little further.. 

     

    You must provide a value expression on the right-hand side of the '-' operator.
    At C:\Windows\AdminArsenal\PDQDeployRunner\service-1\exec\Google Chrome - Unins
    tall per-user.ps1:72 char:20
    + IF ($item.SID - <<<< in $UnloadedHives.SID) {
    + CategoryInfo : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : ExpectedValueExpression

    0
  • I re-read the code. It's loading in a registry hive, and doing work on it. Since I was testing as myself on the machines, my hive was in use and not being looked at. Hence the non removal part, but again, still did not receive the error message you are receiving! Just wanted to clarify that I know why I wasn't seeing a removal on my end :)

    0
  • Yup, it's basically the same logic

     

    Go from this: 

    IF ($item.SID -in $UnloadedHives.SID) 

    To This on line 72:

    IF ($UnloadedHives.SID -contains $Item.SID)

    0
  • It worked! You sir are a genius. If they had a "helper rating" thumbs up I'd surely give one to you! 

    0
  • Awesome bud. Glad to help.

    0
  • AA guys, I'd recommend looking at this fix globally. You tested against Powershell 4, which is awesome, but the code isn't very backwards compatible with clients running older versions of Powershell on their systems. 

     

    You could rather wrap a version check around it, or just change your code to match what I've found works here.

    0
  • Gone! 

    0
  • I just love it when a plan comes together!

    0
  • Hi guys,

    It should be good for PowerShell 3 and higher on the target machines.  If you look at the Package Properties and the notes we state that.  Sorry you ran into this issue Dan but love that you guys are supporting each other and helping to get the problem resolved which is the more important thing.

    0
  • Well I'll be damned. It sure does say Powershell 3.0. I didn't even read the properties page. I jumped right to the code with "This is probably a Powershell 2.0 problem"  in my head. And I was right!

    0
  • Looks like I'll be downloading Powershell 4.0 KB from microsoft and pushing that out:) 

    0