Control Remote Computer's Speaker Volume

Welcome Forums General PowerShell Q&A Control Remote Computer's Speaker Volume

Viewing 4 reply threads
  • Author
    Posts
    • #96384
      Participant
      Topics: 1
      Replies: 1
      Points: 0
      Rank: Member

      Hi,

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

      FunctionSet-Speaker($Volume){$wshShell=new-object-comwscript.shell;1..50|%{$wshShell.SendKeys([char]174)};1..$Volume|%{$wshShell.SendKeys([char]175)}}

      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?

    • #96465
      Participant
      Topics: 2
      Replies: 1000
      Points: 1,982
      Helping Hand
      Rank: Community Hero

      Unless you have PSremoting enabled, and you are the local admin on the remote host. You cannot do this.

      You also must use implicit / explicit remoting to run this type of commands.
      You also, must understand how to use local variables in remote session, if you plan to use them.

      If these remote host are in domain joined, you have to manually setup PSRemoting in workgroup mode.

      All this is documented on TechNet and all over the web.

      Just do a search for:
      PSRemoting powershell
      PSRemoting workgroup
      PSRemoting local variables
      PSRemoting permissions

    • #96495
      Participant
      Topics: 1
      Replies: 1
      Points: 0
      Rank: Member

      PSremoting is enabled and I have admin permissions.

    • #96516
      js
      Participant
      Topics: 27
      Replies: 717
      Points: 1,886
      Helping Hand
      Rank: Community Hero
    • #96584
      js
      Participant
      Topics: 27
      Replies: 717
      Points: 1,886
      Helping Hand
      Rank: Community Hero

      After putting the missing spaces in:

      Function Set-Speaker($Volume){$wshShell=new-object -com wscript.shell;1..50|%{$wshShell.SendKeys([char]174)};
      1..$Volume|%{$wshShell.SendKeys([char]175)}}
      

      This seems to be the way to do it (https://stackoverflow.com/questions/15979445/run-a-local-function-on-a-remote-computer), but it didn't work for me. I even tried installing the script remotely.

      invoke-command comp001 ${function:set-speaker} -ArgumentList 10
      
Viewing 4 reply threads
  • The topic ‘Control Remote Computer's Speaker Volume’ is closed to new replies.