Re: Script to move the servers in HPSA console (1237 Views)
Reply
Visitor
kendalepr
Posts: 2
Registered: ‎02-22-2013
Message 1 of 8 (1,258 Views)

Script to move the servers in HPSA console

HI All , 

 

I am using Windows HPSA client to connect HPSA console. 

 

I want to use HPSA for windows patching pourpose. I have large numbers of windows servers with complex patching and it keep on changing. like we have 30 days path cycle and each day approx 200 are set for patching on different time frame. 

 

I do not want to make the changes manually.

 

I want to know do we have script to move the servers from "All manage" location to specified folder and how to use it ?

Frequent Advisor
Probir
Posts: 48
Registered: ‎11-09-2011
Message 2 of 8 (1,237 Views)

Re: Script to move the servers in HPSA console

We can create a device group and add the required servers to the device group. Servers can be added using OGFS method

 

 

 

/opsw/api/com/opsware/server/ServerService/method/addDeviceGroups self:n=<servername> groups:n=<group short name>

 

Instead of group:n, you can use group:i where i would be the object id of the device group as the group seems to be constant for all the servers.

 

You can write a script which call the method for each of the servers.

 

Hope this helps.

 

Regards,

Probir

Visitor
kendalepr
Posts: 2
Registered: ‎02-22-2013
Message 3 of 8 (1,232 Views)

Re: Script to move the servers in HPSA console

 Hi Thanks for update .

 

I found more symplified method for this .

 

1  From the Navigation pane, select Devices > Device Group. 

2  Navigate to the desired static device group. Select the device group in the Content pane, and from the Actions menu, select Open. The Device Group Explorer appears.

3  From the Views pane of the Device Explorer window, select Device Membership. This displays a list of servers in the group.

4  From the Actions menu, select Import.... The Import window appears.

5  add servers you want to move in one CVS file . Select the CSV file and click Open. This displays the Add Members to Group window that lists the servers that can be added to the device group.

6  Select the servers you want to add to the device group.

Occasional Visitor
Sridhar_123
Posts: 2
Registered: ‎12-04-2013
Message 4 of 8 (1,012 Views)

Re: Script to move the servers in HPSA console

HI,

 

 

 

I want to genrate the log from HPSA to excel sheet. please provide that script .

 

 

Thanks for your help.

 

Thnaks,

Sridhar

Valued Contributor
LarsB
Posts: 28
Registered: ‎03-23-2010
Message 5 of 8 (1,008 Views)

Re: Script to move the servers in HPSA console

A log of servers that were moved from Device Group A to Device Group B?
-- Lars
http://www.augustschell.com
Occasional Visitor
Sridhar_123
Posts: 2
Registered: ‎12-04-2013
Message 6 of 8 (1,005 Views)

Re: Script to move the servers in HPSA console

  1. I am alos  uding hPSA tool.a adn running the inventory and compliance report.please send me the few script related to this. thanks

    kendalepr wrote:

    HI All , 

     

    I am using Windows HPSA client to connect HPSA console. 

     

    I want to use HPSA for windows patching pourpose. I have large numbers of windows servers with complex patching and it keep on changing. like we have 30 days path cycle and each day approx 200 are set for patching on different time frame. 

     

    I do not want to make the changes manually.

     

    I want to know do we have script to move the servers from "All manage" location to specified folder and how to use it ?


Valued Contributor
Dimiter Todorov
Posts: 109
Registered: ‎03-02-2010
Message 7 of 8 (985 Views)

Re: Script to move the servers in HPSA console

Read the Manual "Platform Developer Guide"

 

From OGSH. (ssh to port 2222 on Primary Core)

 

Here is a simple snippet that uses BASH and searches for servers in ~/snames.txt and places them in GROUP_ID

I havent used this since SA 7.8, but it should work.

Most of my scripts now use pytwist, or the Java API.

 

#!/bin/bash
SERVERFILE=~/snames.txt
TMPFILE=~/server-list.txt
GROUP_ID=106460001
rm -f $TMPFILE

for n in `cat $SERVERFILE`
do
        echo $n
        cd /opsw/api/com/opsware/server/ServerService/method
        ./.findServerRefs:i \
        filter="{ ServerVO.hostname CONTAINS $n }" >> $TMPFILE
done

for ID in `cat "$TMPFILE"`
do
echo Server ID: $ID
/opsw/api/com/opsware/server/ServerService/method/addDeviceGroups self:i=$ID groups:i=$GROUP_ID
echo
done

 

Occasional Visitor
jain_vargh
Posts: 1
Registered: 3 weeks ago
Message 8 of 8 (67 Views)

Re: Script to move the servers in HPSA console

Hi,I done search in entire web ,unable to find  any working command/sysntax for a small scripts.

 

I need to create a Device group in my local id(private) , strcuture of group is  ABC Project/XPhase/Environment

 

Then add the server to ecah group, this part I know, but creating group and then get GID of that group ..dont know.

 

Please share any scripts/working commands..

 

 

 

 

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.