none
SpeculationControl No Longer Works Remotely Against Hostnames Containing Hyphens RRS feed

  • General discussion

  • Since downloading the latest version, issuing the command

    Invoke-Command -ComputerName server-name ${function:Get-SpeculationControlSettings}

    returns the error

    You must provide a value expression on the right-hand side of the '-' operator.
        + CategoryInfo             : ParserError: (:) [], ParseException
        + FullyQualifiedErrorId : ExpectedValueExpression
        + PSComputerName    : server-name

    If I use a hostname without a hyphen everything works as before.  I have numerous machines which follow this naming convention. 

    Can someone please help?

    • Changed type Bill_Stewart Monday, July 29, 2019 7:30 PM
    • Moved by Bill_Stewart Monday, July 29, 2019 7:30 PM This is not support forum for gallery scripts
    Monday, September 17, 2018 6:25 PM

All replies

  • Quote the computer name.

    -- Bill Stewart [Bill_Stewart]

    Monday, September 17, 2018 7:24 PM
  • Tried that, also tried using IP address... neither works.
    Tuesday, September 18, 2018 12:25 PM
  • Try using single 'quotes' around the computer name? Or the "server'-name" part?
    Tuesday, September 18, 2018 1:47 PM
  • Tried that, also tried using IP address... neither works.

    When you say that something didn't work, you have to say how it didn't work. (Remember, we can't see your screen.) Please copy and paste the exact command you are running and the exact error message. (Please copy and paste the text of the command and error message, not a screen shot.)


    -- Bill Stewart [Bill_Stewart]

    Tuesday, September 18, 2018 2:58 PM
  • I tried single quotes... I get the exact same error no matter which workaround I use.  The error I receive is in the original post.  Here is it again:

    You must provide a value expression on the right-hand side of the '-' operator.
        + CategoryInfo             : ParserError: (:) [], ParseException
        + FullyQualifiedErrorId : ExpectedValueExpression
        + PSComputerName    : server-name

    Also our naming convention contains two hyphens sadly.  Not sure how to use this formatting ("server'-name") in that case.  I tried it against the one server we have with a single hyphen, received the same error. 

    Our names look like this:  AA-AAA-99.

    The odd thing is there was no issue till the latest release that checks for L1 terminal fault.

    Very frustrating.




    • Edited by Kibbler Tuesday, September 18, 2018 5:46 PM
    Tuesday, September 18, 2018 5:34 PM
  • You did not post the exact command that you are running.

    Again: We cannot see your screen.


    -- Bill Stewart [Bill_Stewart]

    Tuesday, September 18, 2018 9:18 PM
  • Just for the sake of testing - what error does

    invoke-command -cn server-name-01 test.ps1

    output in your case? Does it ask for a proper -FilePath (file not found) or still nags you about ComputerName?



    Wednesday, September 19, 2018 4:54 AM
  • My original post contains the command (verbatim) and the error message (verbatim). Only the host name has been changed.  Not sure why this is not being recognized.

    Here is the command, again:

    Invoke-Command -ComputerName server-name ${function:Get-SpeculationControlSettings}

    When running command:

    invoke-command -cn server-name-01 test.ps1

    It returns a path error, yes:

    invoke-command : Cannot find path 'C:\Windows\system32\test.ps1' because it does not exist.
    At line:1 char:1
    + invoke-command -cn server-name-01 test.ps1
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (C:\Windows\system32\test.ps1:String) [Invoke-Command], ItemNotFoundExce
       ption
        + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.InvokeCommandCommand


    • Edited by Kibbler Wednesday, September 19, 2018 11:52 AM
    Wednesday, September 19, 2018 11:44 AM
  • $f = get-item function:Get-SpeculationControlSettings
    Invoke-Command -ComputerName server-name -ScriptBlock $f.ScriptBlock

    \_(ツ)_/



    • Edited by jrv Wednesday, September 19, 2018 11:52 AM
    Wednesday, September 19, 2018 11:51 AM
  • Same error, thanks for trying.  I think there's a forum just for this script, I will try posting there.
    Wednesday, September 19, 2018 2:02 PM
  • That's an entirely different error than the first error you posted.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, September 19, 2018 4:38 PM
  • Different command, different error.
    Wednesday, September 19, 2018 5:14 PM
  • Please limit topics to one question per discussion. This helps to avoid confusion.

    -- Bill Stewart [Bill_Stewart]

    Wednesday, September 19, 2018 10:57 PM
  • If you would bother to read the thread carefully you would see how my response is on the same question/topic (I was asked to try a different command to debug this issue).  I would also not have to restate the same information over and over again.  Not sure which is more frustrating at this point, the issue or the repeated lackadaisical responses!







    • Edited by Kibbler Thursday, September 20, 2018 1:53 AM
    Thursday, September 20, 2018 1:50 AM
  • If you would read the thread carefully you would see how my response is on the same question/topic.  (I was asked to try a different command to debug this issue).  I would also not have to restate the same information over and over again.  Not sure which is more frustrating at this point, the issue or the repeated lackadaisical responses!




    Please keep in mind that this is not a Microsoft support forum.  It is a community forum manned by volunteers.

    If you need help I recommend contacting Microsoft support and open an issue.  Based on the information you have provided there is no reason to believe that the issue is with the command call.  You will need to have MS techs look at your system and usage in detail. 

    I will also suggest restating all ADWS services on your domain as ADWS has been seen to cause weird issues.


    \_(ツ)_/

    Thursday, September 20, 2018 2:00 AM
  • I do appreciate people trying to help but I would think after pointing out several times I was providing accurate and sensible information, the unwarranted "scolding" would stop.  It was very counter productive.

    I sincerely doubt this has anything to do with ADWS as other versions of the script are handling the variable properly.  From what I can tell the command is not even making to the point of looking for the hostname in AD, it is seeing the parameter as having a syntax error.

    I have posted the issue here, so hopefully someone else has seen it before.

    https://gallery.technet.microsoft.com/scriptcenter/Speculation-Control-e36f0050/view/Discussions






    • Edited by Kibbler Thursday, September 20, 2018 12:03 PM
    Thursday, September 20, 2018 11:54 AM
  • That suggests you have a corrupted install of RSAT or issues with the Net Framework.

    This is not the correct forum for getting help with repairing a broken system.  Contact MS support and open an issue and they will help you troubleshoot this.


    \_(ツ)_/

    Thursday, September 20, 2018 11:57 AM
  • RSAT is not installed on the system where I am running the command.

    I tried issuing it from a second system, same error message.  So either .Net is broken on both or the script is the issue. I'm still leaning to the latter.

    It would be really helpful is someone could confirm this works for them.

    Thursday, September 20, 2018 12:13 PM
  • The PowerShell CmdLets are part of RSAT.

    To test the error do this:

    Invoke-Command -ComputerName server-name -ScriptBlock {dir}

    If you get the same error then something is broken.

    If the "function" is not a script function then it will not work.


    \_(ツ)_/

    Thursday, September 20, 2018 12:20 PM
  • Full disclosure, I am a PS neophyte.

    I assumed you wanted that command entered as is with a valid computer name. 

    When I do so it just returns to a blank command prompt, no error.

    PS C:\ADV180018\SpeculationControl> Invoke-Command -ComputerName xx-xxx-xxx -ScriptBlock {dir}
    PS C:\ADV180018\SpeculationControl>

    This module (SpeculationControl.psd1) has to be imported btw, it is not part of the standard install.

    Thursday, September 20, 2018 12:49 PM
  • Which proves there is no issue with the computername parameter with hyphens in the name.

    The issue is clearly the function you are trying to pass.  The function is likely a DLL based or backed function that cannot be passed as a scriptblock.


    \_(ツ)_/

    Thursday, September 20, 2018 12:54 PM
  • Well yes, I know the issue is with the latest version of the Get-SpeculationControlSettings function.  That function could be passed the scriptblock until the latest rev.  I was hoping there was syntax tweak/workaround.  Apparently not.

    I will probably have to look at a different approach.

    Thursday, September 20, 2018 1:22 PM