How can I change all my devices to active from retired without using the GUI

Document ID : KB000116852
Last Modified Date : 03/10/2018
Show Technical Document Details
Missed polling after device deleted re-added to Spectrum. 4200 devices stopped polling after 9/8/18. All devices are in retired state. How can I set all the devices to active without using the GUI? 
Here are the commands to set the devices to active. The first one gets all the Retired elements and puts them in a list.
You will need to remove the fist line in the file /tmp/devices.txt it is a header.

1. mysql -unetqos -pnetqos netqosportal -e 'select itemid from t_device where LifeCycleState="Retired"';> /tmp/devices.txt
2. Edit /tmp/devices.txt to remove the first (header) line.
3. for ID in `cat /tmp/devices.txt`; do curl -v -X PUT -u admin:admin -H 'Content-type: acation/xml' http://<PC_SYSTEM>:8181/pc/center/webservice/devices/deviceItemId/$ID/lifeCycleState/Active; done