Linux Blog

Remotely Changing Windows Volume

Filed under: Shell Script Sundays — TheLinuxBlog.com at 2:41 pm on Sunday, October 18, 2009

This is not really “shell scripting” but the end result is some more bash scripts in my bin directory so what the hell? It’s going in the shell script section because its Sunday. So what?

I like to listen to music on my Windows box while I work on my Linux box. Online radio and other sounds, just get in the way too much. One of the things I wanted to do for a while was remotely control my volume so I didn’t have to use my KVM to switch over to change the volume when ever anyone came in my office.

Its actually pretty easy to control your windows volume from Linux.

At first I thought, I’d create a dummy audio device, and some how map it over. Then I figured that was overkill and I’d try something a bit easier. I have SSH via Cygwin, so all I needed was a way to control the volume locally, and I could execute the command with SSH. Having no volume utilities jump at me when I looked through the Cygwin repositories I went to look for something else.

NirCmd is an awesome utility, giving me and other Windows users the ability to do things that Linux users may take for granted, you can read about it here: http://www.nirsoft.net/utils/nircmd.html after installing it, and making sure that my corporate AV didn’t throw a hissy, it was just a matter of dumping some scripts in my bin directory and chmodding them so they would run.

Here is what they look like:

Volume Down Script: ssh windowsbox -l owen -C “nir changesysvolume -2000″

Volume Up Script: ssh windowsbox -l owen -C “nir changesysvolume 2000″

Mute: ssh windowsbox -l owen -C “nir mutesysvolume 1″

Unmute: ssh windowsbox -l owen -c “nir mutesysvolume 0″

Real simple, and the mute/unmute really comes in handy for when some one walks into my office.

Aim for the Simple, not the Turd.

Filed under: General Linux — TheLinuxBlog.com at 10:18 am on Wednesday, March 18, 2009

TurdWhen something doesn’t work as expected, or stops working, for your own sake try the simple things first. It may seem pretty obvious to most people, but sometimes we all need a reminder. Recently I have been over complicating problems and landing in giant piles of turd.

I was going nuts one day because I couldn’t listen to streaming radio while I was trying to work. I started messing with all the settings, reconfiguring my sound card. I Removed the sound module and probed it again. Turns out that the reason my headphones were not working was because the cable was unplugged. Hey! it happens with those Dell’s with the slanted front inputs, but I’m still stupid for not checking the speaker volume first.

Fortunately this one was not me, but is still a funny story and something I’m sure most technicians will be familiar with.
User: “I can’t connect to the network”
Tech: “Is it plugged in?”
User: “How do I plug it in if it’s wireless?”
Tech: “Oh, why didn’t you say? Are you sure you’re connected to the right network?”
User: “How do I tell? The thing that normally tells me is gone”
Tech: “Ok, I’ll be there in a sec”
The technician tried to reinstall the driver, change the firewall settings and everything possible. Turns out they forgot to ask them if they’d hit the wireless function key.

Fresh off of the stupid, this one just happened to me five minutes ago. I was switching my KVM over to my Windows machine. I got nothing but a black screen and monitor telling me it was going to bed. My mind told me that Windows had crashed as usual and that I better shut it down and restart. I pressed the power button and waited. I’m used to Linux shutting down pretty quickly so since it was taking its time, I thought it had properly frozen up like it sometimes does. I held the power button in for the dreaded five seconds, poured myself a cup of coffee and turned it back on. What? Nothing! oh yea, I was rummaging around down there yesterday. What’s this? A loose video cable? Crap!

Who’s the sucker now?

Next time you jump off of the diving board of problem solving just remember to try the simple solutions first.
I’d love to hear your stories, and the pile of turd you landed in.