chgp command
Use the chgp command to modify groups, including changing membership, modifying attributes, and processing change-specification files.
Synopsis
smcli chgp [-h | -? | --help]
smcli chgp [-v] {-f file_name}
smcli chgp [-v] {-e extend_list | -r remove_list | -m new_name | -D "new_criteria"} {group_name | group_oid}
Operands
This command uses a group name or ID as an operand. This operand is required if you do not specify a group-definition file using the -f | --file option.
- group_oid
- The unique ID of the group, specified as a hexadecimal value prefixed
with 0x (for example, 0x3e7). Tip: Use the lsgp -o command to list all group IDs.
- group_name
- The name of the group. If the group name contains spaces, enclose
it in quotation marks. If it contains a comma, prefix the comma with
a backslash (\) and enclose the name in quotation
marks.Tips:
- Group names are unique.
- Use the lsgp command without any options to list all group names.
- The group names are not locale specific.
Options
- -D | --dynamic "group_criteria"
- Changes the criteria of a dynamic group to the specified criteria.
The group_criteria statement uses the form of one or more inventory-value comparison statements joined by Boolean operators. Use parentheses to specify the order of comparison operations and to combine logical operations.
You can specify these comparison operators:- =
- ==
- !=
- >
- <
- >=
- <=
You can specify these Boolean operators:- AND to indicate that all group criteria are met
- OR to indicate that any of the group criteria are met
Tip: Use the lsinv command with no options to list the inventory values that can be used for comparison.- -e | --extend {group_member}[,{group_member}... ]
- Adds one or more resources (including systems, groups,
updates, or tasks) as members of the group.
The group members can be specified by name, ID, or ID string. This list can be a mixture of names, IDs, and ID strings, separated by a comma.
- system_oid
- The unique ID of the system, specified
as a hexadecimal value prefixed with 0x (for example, 0x37)
or a decimal value (for example, 123).Tip: Use the lssys -o command to list all system IDs.
- system_name
- The name of the system.
If the system name
contains a comma, prefix the comma with a backslash (\).Tips:
- The system names might not be unique. This command acts on all systems with the specified name. Use the -v | --verbose option to generate a message when this command targets multiple systems with the same name. To target a particular system that has a name that is not unique, identify the system by specifying its unique, hexadecimal ID, or use additional target options to refine the selection.
- Use the lssys command without any options to list all system names.
- The system names are not locale specific.
- group_oid
- The unique ID of the group, specified as a hexadecimal value prefixed
with 0x (for example, 0x3e7). Tip: Use the lsgp -o command to list all group IDs.
- group_name
- The name of the group. If the group name contains spaces, enclose
it in quotation marks. If it contains a comma, prefix the comma with
a backslash (\) and enclose the name in quotation
marks.Tips:
- Group names are unique.
- Use the lsgp command without any options to list all group names.
- The group names are not locale specific.
- task_oid
- The unique ID of the task, specified as a hexadecimal value prefixed
with 0x (for example, 0x37).Tip: You can use the lstask -o -r command to list all task IDs that are valid for the targeted system.
- task_id_string
- The unique ID string of the task, prefixed with a percent sign
(%) (for example, %ServerCfgTask). If the string
ID contains a comma, prefix the comma with a backslash (\).Tip: You can use the lstask -I command to list all task ID strings that are valid for the targeted system.
- task_title
- The title of the task. The task title must be fully qualified
with the parent task (for example, grandparent_task_title/parent_task_title/task_title).
If the task name contains a comma, prefix the comma with a backslash
(\). Enclose the task title in quotation marks if it contains a space
character. Tips:
- Task names might not be unique. This command acts on all tasks with the specified name. Use the -v | --verbose option to generate a message when this command targets multiple tasks with the same name. To target a task that has a name that is not unique, identify the task by specifying its unique, hexadecimal task ID, or use additional target options to refine the selection.
- Locale-specific task names might not exist for every noninteractive task. The name specified must match the locale being used by the command line interface.
- Use the lstask -r command to list all tasks that are valid for the targeted system.
- update_oid
- Specifies the unique ID of an update, specified as a hexadecimal
value prefixed with 0x (for example, 0x37).Tip: Use the lsupd -o command to list all update IDs.
- update_fix_id
- Specifies the unique fix ID of an update (for example, SF99001G-47).Tip: Use lsupd -A DisplayName,UpdateId to list the current fix IDs.
- -f | --file {file_name | -}
- Retrieves data either from the input file file_name or
from input piped from another command.
To retrieve input piped from another command, specify a hyphen (-) instead of a file name (for example, smcli cmd1 | smcli cmd2 -f -). To retrieve input from a file, specify the full path. If the path contains spaces, enclose it in quotation marks.
- The input data is the list of groups to modify. There can be one
group definition per line. Each group definition in the input file
must be separated by a line break. The group definition must use one
of these formats, depending on the type of group being created:
{group_name|group_oid}:criteria:"group_criteria" {group_name|group_oid}:extend:{member_oid|member_name}[,{member_oid|member_name}...] {group_name|group_oid}:remove:{member_oid|member_name}[,{member_oid|member_name}...] {group_name|group_oid}:move:new_nameFor a description of the arguments, see the -D | --dynamic, -e | --extend, -m | --move, and -r | --remove options.
- -h | -?
- Displays the syntax and a brief description of the command. Tip: If you specify additional options other than -h | -? | --help, the options are ignored.
- --help
- Displays detailed information about the command, including the
syntax, a description of the command, a description of the options
and operands, error codes, and examples. Tips:
- If you specify additional options other than -h | -? | --help, the options are ignored.
- You can also display detailed help in the form of man pages using the man command_name command.
- -m | --move new_group_name {group_oid | group_name}
- Renames the group specified by group_oid or group_name to
a new name specified by new_group_name.
- group_oid
- The unique ID of the group, specified as a hexadecimal value prefixed
with 0x (for example, 0x3e7). Tip: Use the lsgp -o command to list all group IDs.
- group_name
- The name of the group. If the group name contains spaces, enclose
it in quotation marks. If it contains a comma, prefix the comma with
a backslash (\) and enclose the name in quotation
marks.Tips:
- Group names are unique.
- Use the lsgp command without any options to list all group names.
- The group names are not locale specific.
- -r | --remove {group_member}[,group_member}...]
- Removes one or more resources (including systems, groups,
updates or tasks), specified by name, ID, or ID string, from the group.
For a description of the arguments, see the -e | --extend option.
- -v | --verbose
- Writes verbose messages to standard output.
If this option is not specified, this command suppresses noncritical messages.
Exit status
The following codes are returned by this command.- 0: The operation completed.
- 1: A usage error occurred.
- 2: The command or bundle was not found.
- 3: The command was not performed because either authentication failed or you are not authorized to perform the action.
- 23: A specified resource (for example, a system, group, update or task) is not valid.
- 25: A number-formatting error occurred.
- 27: A specified attribute is not valid.
- 29: The specified locale is not valid or not supported.
- 50: A specified group is read-only.
- 52: The inventory criteria for the dynamic group were not valid.
Examples
- Remove a system from
a group
This example illustrates how to remove a single system named WebServer1 from the static group named WebSystems.
smcli chgp -r WebServer1 WebSystems - Rename a group
This example illustrates how to rename RemoteGroup to RemoteTaskGroup.
smcli chgp -m RemoteTaskGroup RemoteGroup - Change criteria of a dynamic group
This example illustrates how to set the criteria for group dynamicgroup1 to all servers that have a license.
smcli chgp -D "Server.HasLicense == 'true'" dynamicgroup1 - Use an input file to modify several groups
This example illustrates how to modify four groups using the data contained in the file c:\temp\modify_groups.txt.
smcli chgp -f c:\temp\modify_groups.txtThe modify_groups.txt file contains the following text:
group1:extend:system_1,system_2 0x300A:extend:group_1,group_2 group2:remove:system_1,system_5 group3:criteria:"Server.HasLicense == 'false'" OldName:move:NewName - Add tasks and groups to an existing group
This example illustrates how to add a task named RemoteControl and group named ServerGroup to the static group named RemoteGroup.
smcli chgp -e "RemoteControl","ServerGroup" RemoteGroup