White Paper
10 Scripting WSMAN Operating System Deployment – Boot Network ISO
wsman_command = 'wsman get http://schemas.dell.com/wbem/wscim/1/cim-
schema/2/%s?%s -N %s -u %s -p %s -h %s -P 443 -v -j utf-8 -y basic -o -m 256 -c %s
-V'
wsman_command = wsman_command % (classname, key_str, namespace, username,
password, ipaddress, cert)
return wsman_command
Set
This API detects the host operating system and constructs the relevant WSMAN set CLI command,
using the input parameters provided. The input parameters for the API are classname, namespace,
keys of the class instance in python dictionary format, name-value pairs to be set on the instance in
python dictionary format, username, password, ipaddress and the SSL certificate. The certificate is
defaulted to dummy.
The constructed command can be directly launched on the command line or shell of the host OS,
using the API detailed in the Launch WSMAN CLI command section.
# Set
def wsman_set_command(classname, namespace, key_dict, arg_dict, username,
password, ipaddress, cert = 'dummy'):
"""
Constructs the WSMan Set Operation command based on the OS and returns
the command to be used.
Sample arguments:
arg_dict = {‘classname’:’DCIM_CS’,’name’:’srv:system’}
"""
# Constuct the keys from the input dictionary, into CLI-specific format
key_str = construct_key_str(key_dict)
# Construct the arguments from the input dictionary, into CLI-specific format
arg_str = construct_arg_str(arg_dict)
if detect_host_os() == 1:
wsman_command = 'winrm s "http://schemas.dmtf.org/wbem/wscim/1/cim-
schema/2/%s?%s+__cimnamespace=%s" -u:%s -p:%s -r:https://%s/wsman -encoding:utf-8
-a:basic -SkipCNcheck -SkipCAcheck -format:pretty @{%s}'
wsman_command = wsman_command % (classname, key_str, namespace, username,
password, ipaddress, arg_str)
else:
wsman_command = 'wsman set http://schemas.dmtf.org/wbem/wscim/1/cim-
schema/2/%s?%s -N %s -u %s -p %s -h %s -P 443 -v -j utf-8 -y basic -R -o -m 256 -c
%s -V %s'
wsman_command = wsman_command % (classname, key_str, namespace, username,
password, ipaddress, arg_str, cert)