Powershell script to find and reboot all GS phones on the network


I Would like to write a script that will find all my IP phones on my local network and reboot them via ssh without having to do each on manually. For context, I’m good with networks but rather rookie at scripting. So my first hurdle would be to find the ip address of each device, probably by finding all devices that start with the mac address of the vendor (in this case Grandstream). The phone all have the same login credentials, so that part will be easy, I just need a command that will find the IP addresses of those devices (similar to an ARP) and then ssh into each device. Rebooting will just be the start and if I can get that to run successfully I can potentially branch out and add other commands to the script. But the idea is to be able to automate tasks to all phones on the network.

Any help would be appreciated. TIY.


See here : https://www.voip-info.org/bash-script-to-remote-reboot-some-grandstream-phones/


Is there a way to do this in Powershell? I know this link is for Linux which I’m not very familiar with.


There has to be. PowerShell is extremely complete, sending an API request is easy, finding all the devices could be trickier but there must be a way.

Also, that link filters the MAC address to Grandstream’s namespace. Make sure to add the new one as well (found in newer devices).


Thats a bash script in the link which can be run on Linux but isn’t exclusive to Linux. BASH scripts can be run on windows using the ssh client which I believe is integrated into Windows 10 now. I don’t use windows at all so I can’t check.
You may want to look at the CTI guide at http://www.grandstream.com/sites/default/files/Resources/CTI_Guide.pdf which may be easier to implement