Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@set APIKEY=your_cloud_api_key
@set URI=https://clients.hostwinds.com/cloud/api.php
@set FILENAME=instances.json
@if exist %FILENAME% del %FILENAME%
@curl %URI% ^
-sS ^
-X POST ^
-d "action=get_instances&API=%APIKEY%" > %FILENAME%
@if %errorlevel% equ 0 (
@REM - Print instance names
@echo Instances
@echo IP OS ServerName Hostname
@echo ----------------------------------------------------------------------
@cat %FILENAME% | jq -r ".success | .[] | [.main_ip, .image.name, .srvrname, .hostname] | @tsv" 2>error.log
@if %errorlevel% equ 0 (
@echo.
@echo ------------------------------
@echo Success
) else (
@REM @echo Exit Code is %errorlevel%
@echo Failed
@cat %FILENAME% | jq
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment