Enterprise Node Commands
Manage an enterprise nodes.
Overview
A node is essentially an organisational unit used to structure users, roles, teams, and provisioning/authentication methods.
Usage
enterprise-node command [--options] OR en command [--options]Alias: en
Commands
The following commands are supported by Enterprise Node commands
Enterprise Node View
View enterprise node.
DotNet CLI
Command: enterprise-node <node name> --command=tree OR en tree -v
Example:
My Vault> enterprise-node DEVOPS --command=treeDotNet SDK
Function: EnterpriseData.Nodes
var nodes = enterpriseData.Nodes
.Where(x => string.Equals(x.DisplayName, arguments.Node, StringComparison.InvariantCultureIgnoreCase))
.ToArray();PowerCommander
Command : Get-KeeperEnterpriseNode
Aliases: ken
Parameters:
NodeId- Node ID (optional, lists all if omitted)
Examples::
# List all nodes
PS> Get-KeeperEnterpriseNode
----------------------------------------
# Get specific node
PS> Get-KeeperEnterpriseNode -NodeId 12345 - Not ImplementedPython CLI
Command: enterprise-node view
Parameter:
node - Node name or UID (required)
Flag:
-v,--verbose- Print verbose information--format- Output format:json--output- Output filename
Python SDK
Function:
node = enterprise_data.nodes.get_entity(node_id) if isintance(node_id, int)
node = [node for node in enterprise_data.nodes.get_all_entities() if node.name.lower() == node_id] if isintance(node_id, str)Enterprise Node Add
Create enterprise node(s).
DotNet CLI
Command: enterprise-node --command=add <name> --parent "<main node>"
Alias :en --command=add <name>
Options:
--parent <node>- Parent node name or ID--name <name>- New node display name (for add/update)-v, --verbose- Show node IDs and additional info--toggle-isolated- Toggle node isolation (restrict visibility)
Example:
My Vault> enterprise-node --command=add "Engineering"
OR
My Vault> en --command=add "Isolated Team" --toggle-isolatedDotNet SDK
Function: CreateNode
public static async Task<EnterpriseNode> CreateNode(this EnterpriseData enterpriseData, string nodeName, EnterpriseNode parentNode = null)Example:
var node = await enterpriseData.CreateNode(arguments.Node, parentNode);PowerCommander
Command: New-KeeperEnterpriseNode
Aliases: kena
Syntax:
New-KeeperEnterpriseNode [-NodeName] <string> [[-ParentNodeId] <long>] [<CommonParameters>]Parameters:
-NodeName- Node name-ParentNodeId- Parent node ID
Example:
PS> New-KeeperEnterpriseNode -ParentName "parent" -NodeName "MyNode"
OR
kena "DevOps" -ParentNodeId 12345Python CLI
Command: enterprise-node add
Parameter:
node - Node Name. Can be repeated. (required)
Flag:
--parent- Parent node name or ID--name,--displayname- Set node display name--set-isolated- Set node isolated:onoroff-f,--force- Do not prompt for confirmation
Python SDK
Function:
from keepersdk.enterprise import batch_management, enterprise_management
node_names = list['names of nodes to be created']
nodes_to_add = [enterprise_management.NodeEdit(
node_id=enterprise_loader.get_enterprise_id(), name=node_name, parent_id=parent_node_id,
restrict_visibility=is_isolated)
for node_name in node_names]
batch = batch_management.BatchManagement(loader=enterprise_loader, logger=enterprise_manager_logger)
batch.modify_nodes(to_add=nodes_to_add)
batch.apply()Enterprise Node Edit
Edit enterprise node(s).
DotNet CLI
Command: enterprise-node --command=update [--options]
Alias : en --command=update [--options]
Options:
--parent <node>- Parent node name or ID--name <name>- New node display name (for add/update)-v, --verbose- Show node IDs and additional info--toggle-isolated- Toggle node isolation (restrict visibility)
Example:
# Update node
enterprise-node --command=update "Engineering" --name "Engineering Dept"
enterprise-node update 12345 --parent "IT"
en update "Sales" --toggle-isolated DotNet SDK
Function: UpdateNode
public static async Task UpdateNode(this EnterpriseData enterpriseData, EnterpriseNode node, EnterpriseNode newParentNode = null)Example:
await enterpriseData.UpdateNode(node, parentNode);PowerCommander
Command: Edit-KeeperEnterpriseNode
Aliases: kenu
Usage:
Edit-KeeperEnterpriseNode [-Node] <string>
[-NewNodeName <string>]
[-ParentNode <string>]
[-RestrictVisibility]
[<CommonParameters>]Parameters:
-Node
Node name or ID to update. This is a positional parameter (position 0).
Options:
-NewNodeName
New name for the node. Use this to rename an existing node.
-ParentNode
New parent Node name or ID. Use this to move the node to a different location in the hierarchy.
-RestrictVisibility
Enable node isolation. When enabled, restricts visibility to users outside the node.
Example:
PS> Get-KeeperEnterpriseNode
Id DisplayName ParentNodeName RestrictVisibility Provisioning
-- ----------- -------------- ------------------ ------------
894448414228482 MS. False
894448414228541 Test node False
PS> Edit-KeeperEnterpriseNode -Node "Test node" -NodeName "test_node_updated2" -ParentNode "MS" -RestrictVisibility
Node "test_node_updated2" updated.
Node Isolation: ON
PS> Get-KeeperEnterpriseNode
Id DisplayName ParentNodeName RestrictVisibility Provisioning
-- ----------- -------------- ------------------ ------------
894448414228482 MS False
894448414228541 test_node_updated2 MS True
Python CLI
Command: enterprise-node edit
Parameter:
node - Node Name or ID. Can be repeated. (required)
Flag:
--parent- Parent node name or ID--name,--displayname- Set node display name--set-isolated- Set node isolated:onoroff
Python SDK
Function:
from keepersdk.enterprise import batch_management, enterprise_management
node = enterprise_data.nodes.get_entity(node_id)
node_list = [node]
nodes_to_update = [enterprise_management.NodeEdit(
node_id=node.node_id, name=display_name, parent_id=node.parent_id, restrict_visibility=is_isolated)
for node in node_list]
batch = batch_management.BatchManagement(loader=enterprise_loader, logger=enterprise_manager_logger)
batch.modify_nodes(to_update=nodes_to_update)
batch.apply()Enterprise Node Delete
Delete enterprise node(s).
DotNet CLI
Command : enterprise-node --command=delete <node name>
Alias : en --command=delete <node name>
Options:
-f, --force- Force reload enterprise data
Example:
# Delete node
My Vault> en --command=delete "Old Department"
OR
enterprise-node --command=delete "Old Department"
enterprise-node --command=delete 12345DotNet SDK
Function: DeleteNode
await enterpriseData.DeleteNode(node.Id);
public static async Task DeleteNode(this EnterpriseData enterpriseData, long nodeId)PowerCommander
Command: Remove-KeeperEnterpriseNode
Aliases: kend
Parameters:
Node
Node name or ID to delete. Can be the node's display name or numeric node ID
Force
Skip confirmation prompt. When specified, deletes the node without asking for confirmation
Usage:
PS > Remove-KeeperEnterpriseNode -Node "Old Department"
PS > kend "Old Department"Example:
PS> Remove-KeeperEnterpriseNode -Node "test_node_1"
Confirm
Are you sure you want to perform this action?
Performing the operation "Delete Enterprise Node" on target "test_node_1".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): a
Node "test_node_1" deleted successfully.Python CLI
Command: enterprise-node delete
Parameter:
node - Node Name or ID (required)
Flag:
--logo-file- Sets company logo using local image file (max size: 500 kB, min dimensions: 10x10, max dimensions: 320x320)
Python SDK
Function:
from keepersdk.enterprise import batch_management, enterprise_management
node = enterprise_data.nodes.get_entity(node_id)
node_list = [node]
batch = batch_management.BatchManagement(loader=enterprise_loader, logger=enterprise_manager_logger)
batch.modify_nodes(to_remove=(enterprise_management.NodeEdit(node_id=node.node_id) for node in node_list))
batch.apply()Enterprise Node Set Logo
Set enterprise node logo.
Python CLI
Command: enterprise-node set-logo
Parameters:
node: Node Name or ID--logo-file: Sets company logo using local image file (max size: 500 kB, min dimensions:
10x10, max dimensions: 320x320)
Example:
My Vault> enterprise-node set-logo <node_uid> --logo-file="logo.jpg"Python SDK
Function:
from keepersdk.vault import attachment
upload_task = attachment.FileUploadTask(logo_filepath)
upload_task.prepare()
# Check file MIME-type and size
if upload_task.mime_type not in {'image/jpeg', 'image/png', 'image/gif'}:
raise Exception('File must be a JPEG, PNG, or GIF image')
if upload_task.size > 500000:
raise Exception('Filesize must be less than 500 kB')
rq_logo = {
'command': f'request_{logo_type}_logo_upload',
'node_id': node_id,
}
rs_logo = KeeperAuth_obj.execute_auth_command(rq_logo)
# Construct POST request for upload
upload_id = rs_logo.get('upload_id')
upload_url = rs_logo.get('url')
assert isinstance(upload_url, str)
success_status_code = rs_logo.get('success_status_code')
file_param: Optional[str] = rs_logo.get('file_parameter')
assert file_param is not None
form_data = rs_logo.get('parameters')
assert isinstance(form_data, dict)
form_data['Content-Type'] = upload_task.mime_type
with upload_task.open() as task_stream:
files = {file_param: (None, task_stream, upload_task.mime_type)}
upload_rs = requests.post(upload_url, files=files, data=form_data)
if upload_rs.status_code == success_status_code:
# Verify file upload
check_rq = {
'command': f'check_{logo_type}_logo_upload',
'node_id': node_id,
'upload_id': upload_id
}
while True:
check_rs = KeeperAuth_obj.execute_auth_command(check_rq)
check_status = check_rs.get('status')
if check_status == 'pending':
time.sleep(2)
else:
if check_status != 'active':
if check_status == 'invalid_dimensions':
raise Exception('Image dimensions must be between 10x10 and 320x320')
else:
raise Exception(f'Upload status = {check_status}')
else:
get_logger().info('File "%s" set as %s logo.', logo_fp, logo_type)
break
else:
raise Exception(f'HTTP status code: {upload_rs.status_code}, expected {success_status_code}')Enterprise Node Invite Email
Set invitation email.
Python CLI
Command: enterprise-node invite-email
Parameter:
node - Node Name or ID (required)
Flag:
-f,--force- Do not prompt for confirmation--invite-email- Sets invite email template from file. Saves current template if file does not exist. Use dash (-) for stdout
Enterprise Node Wipe Out
Wipe out node content.
Python CLI
Command: enterprise-node wipe-out
Parameter:
node- Node Name or ID (required)
Warning: This action cannot be undone and will remove all users, roles, teams, and subnodes.
Python SDK
Function:
from keepersdk.enterprise import batch_management, enterprise_management
node = enterprise_data.nodes.get_entity(node_id)
if node.node_id == enterprise_data.root_node.node_id:
raise ValueError('Cannot wipe out root node')
subnode_lookup: Dict[int, List[int]] = {}
for n in enterprise_data.nodes.get_all_entities():
parent_id = n.parent_id or 0
if parent_id not in subnode_lookup:
subnode_lookup[parent_id] = []
subnode_lookup[parent_id].append(n.node_id)
sub_nodes = [node.node_id]
pos = 0
while pos < len(sub_nodes):
if sub_nodes[pos] in subnode_lookup:
sub_nodes.extend(subnode_lookup[sub_nodes[pos]])
pos += 1
nodes = set(sub_nodes)
batch = batch_management.BatchManagement(loader=enterprise_loader, logger=enterprise_manager_logger)
roles = {x.role_id for x in enterprise_data.roles.get_all_entities() if x.node_id in nodes}
users = {x.enterprise_user_id for x in enterprise_data.users.get_all_entities() if x.node_id in nodes}
role_users = [enterprise_management.RoleUserEdit(role_id=x.role_id, enterprise_user_id=x.enterprise_user_id)
for x in enterprise_data.role_users.get_all_links() if
x.role_id in roles or x.enterprise_user_id in users]
if len(role_users) > 0:
batch.modify_role_users(to_remove=role_users)
managed_nodes = [enterprise_management.ManagedNodeEdit(role_id=x.role_id, managed_node_id=x.managed_node_id)
for x in enterprise_data.managed_nodes.get_all_links() if
x.managed_node_id in nodes or x.role_id in roles]
if len(managed_nodes) > 0:
batch.modify_managed_nodes(to_remove=managed_nodes)
roles_to_remove = [enterprise_management.RoleEdit(role_id=x) for x in roles]
if len(roles) > 0:
batch.modify_roles(to_remove=roles_to_remove)
users_to_remove = [enterprise_management.UserEdit(enterprise_user_id=x) for x in users]
if len(users_to_remove) > 0:
batch.modify_users(to_remove=users_to_remove)
queued_teams = [enterprise_management.TeamEdit(team_uid=x.team_uid)
for x in enterprise_data.queued_teams.get_all_entities() if x.node_id in nodes]
if len(queued_teams) > 0:
batch.modify_teams(to_remove=queued_teams)
teams = [enterprise_management.TeamEdit(team_uid=x.team_uid)
for x in enterprise_data.teams.get_all_entities() if x.node_id in nodes]
if len(teams) > 0:
batch.modify_teams(to_remove=teams)
sub_nodes.pop(0)
sub_nodes.reverse()
nodes_to_remove = [enterprise_management.NodeEdit(node_id=x) for x in sub_nodes]
if len(nodes_to_remove) > 0:
batch.modify_nodes(to_remove=nodes_to_remove)
batch.apply()Last updated
Was this helpful?

