PowerShell Remote Function RRS feed

  • Question

  • Hi,

    I would like to run the following power shell script on a remote computer


    Set-Speaker  - Volume 10

    I have tried to use the Invoke command without success, any suggestions on how to make it work on a remote computer?

    • Moved by Bill_Stewart Wednesday, May 9, 2018 2:39 PM Unanswerable drive-by question
    Monday, March 19, 2018 1:16 PM

All replies

  • Hi,

    How did you try to use Invoke-Command so far?

    I would use exactly that.

    Monday, March 19, 2018 1:22 PM
  • FunctionSet-Speaker($Volume){$wshShell=new-object-comwscript.shell;1..50|%{$wshShell.SendKeys([char]174)};1..$Volume|%{$wshShell.SendKeys([char]175)}}

    Invoke-Command -ComputerNameTUHERZ-DT00012-ScriptBlock${function:Set-Speaker} 

    that worked until this part but I'm not sure how to run the "set-Speaker -Volume 10"


    Monday, March 19, 2018 1:24 PM
  • $volume = 10
    Invoke-Command -ComputerName TUHERZ-DT00012 -ScriptBlock ${function:Set-Speaker} -ArgumentList $volume

    Does this work?

    If not, what error message are you getting?

    And please post code in a readable format.

    Monday, March 19, 2018 1:35 PM
  • Hi,

    i'm not getting any error now, but the command doesn't do anything.

    Monday, March 19, 2018 1:48 PM
  • You cannot remotely change a users volume.  Volume settings are per-user and not per-machine.


    Monday, March 19, 2018 6:06 PM
  • there is no way to do it with PowerShell?

    Tuesday, March 20, 2018 7:11 AM
  • That is correct.


    Tuesday, March 20, 2018 7:18 AM