Calling linux commandline functions from NODE.JS

Currently I’am working on a project, where device management (dm) is needed. So a part of dm is to control devices remotely. My setup is a linux based device, that is connected to Azure Clouds IoT Hub with the new DeviceManagement-Feature. That device is controled by a NodeJs-App. One task of that is, to handle a reboot signal from the cloud. The problem I had, was to break through the node.js environment and to convince the device, to reboot. After some try-outs, I came up with following simple solution – maybe someone has the same problem, than this is a good start:

1) npm install sys child_process

2) …and use it as follows:


Chocolatey – a sweet package manager for Windows

Some days ago a friend of mine talked some curios things about chocolate or something like that, to me. First I did’not understand, what he’d like to say, but than it became a little clearer to me.

Chocolatey…, is no sweet or something of that kind, but it is a powerful new package manager for Windows user, that Safes a lot of time.

The old way

As a user afflicted with permanent System Setups and therefor permanently reinstalling the most common tools that are often used, like Notepad++ or KeePass , I found chocolatey sweet as chocolate.

Chocolatey is, as I mentioned before, a Kind of Package Manager like opkg, apm or other package manager known from Linux OS. Developers – mainly Visual Studio Devs – know that concept from NuGet. With that Chocolatey it’s now pretty simple, keeping the own local repository of tools clean and maintainable with a Windows OS.

Consider the following scenario (you know that, of course):
You have a PC, that is fresh and clean – reinstalled after a system crash (or for other reason ). Now you have to go through a huge list of often used tools, that you can recall. But most times you are not catching all of them. So you are engaged with installing tools a long time after reinstallation.
Ok…. lucky guy, if you have all of the tools as portables saved to an USB stick, but in that moment, you don’t know, where to find this stick or it’s laying around some where in your home – where you are not.
Same applies to uninstalling software. Sometimes you do not have installed software and you don’t know, where it has been saved to. In that case, you either have to install other software to search for executable like Everything Search Engine or do it by hand. In all cases, it is hard to overcome his inhibition, to setup a new WinOS.

With Chocolatey things are changing…

I wrote a little powershell script, that keeps a of all tools, I need for my daily life. As an IT Pro, I often need Notepad++, KeePass, 7zip, GitHub, RegexTester, TreeSize and a lot more. This Script does the following. It downloads Chocolatey, if not already installed. It continues looping through my list of tools and  installs them each by another. The good thing with this approach is, that I have not to care about where to retrieve install files, updates and there is no more spamming of my download folder with Zips.
That script is saved to my OneDrive, so I have it “with me”, where ever I have to setup a machine.

Starting with Chocolatey (Homepage)

open up a Powershell as Administrator an type in the following line
iex ((new-object net.webclient).DownloadString ‘’))
(there is also a solution for cmd at theire hompage)

Now you can start installing a tool. Let’s take regextester!
Type choco install regextester 

You will be asked for permission to install, by typing 1 for YES
(that could be automated by the use of –y at the end of a install command)
What I also should mention is the fact, that, if a tool is, for example no installable (portable for example), choco generates an icon and a link, to find and execute it by mouse for example.

The chocolatey repository could be searched by two ways: at their hompage or from powershell choco list/search <keyword>
e.g. choco search regex
leads to following result:

Your local repository could be reviewed by
choco list –l

And removing a tools could not be any easier
choco uninstall recuva.portable

Updates, if there are any, could be made by
choco upgrade notepadplusplus


With these simple commands your own local repository is maintainable in an easy and fast way. The benefit of replaying these actions, either automated ore by hand, in “forward/backward”-style is so sweet, that I use it now consequently on all my dev-machines and friends PCs for maintenance. Build your own script or use mine and you will see, it could not be more simple.

(add that code to a file e.g. chocolatey_install.ps1 and call it with parameter 0, if you like to make a fresh install of chocolatey and tools or only upgrading local repository)


$tools = @(
“7zip”, #Packer
“notepadplusplus”, #texteditor
“procexp”, #process explorer (Task manager)
“adobereader”, #PDF reader
“keepass.install”, #password manager
“treesizefree.portable”, #getting filesizes (sorted/visualized overview)
“irfanview”, #picture viewer
“winmerge”, #comparing files and folders in file system (also usable with TFS)
“rdcman” #manages RDP sessions

if($upgrade -eq 0){
iex ((new-object net.webclient).DownloadString(‘′))

$tools | % {choco install $_ -y}
$tools | % {choco upgrade $_ -y}