White Paper
9 Scripting WSMAN Operating System Deployment – Boot Network ISO
"""
if detect_host_os() == 1:
wsman_command = 'winrm e "http://schemas.dmtf.org/wbem/wscim/1/cim-
schema/2/%s?__cimnamespace=%s" -u:%s -p:%s -r:https://%s/wsman -encoding:utf-8 -
a:basic -SkipCNcheck -SkipCAcheck -format:pretty -returntype:epr'
wsman_command = wsman_command % (classname, namespace, username, password,
ipaddress)
else:
wsman_command = 'wsman enumerate http://schemas.dmtf.org/wbem/wscim/1/cim-
schema/2/%s -N %s -u %s -p %s -h %s -P 443 -v -j utf-8 -y basic -o -m 256 -c %s -V
-M epr'
wsman_command = wsman_command % (classname, namespace, username, password,
ipaddress, cert)
return wsman_command
Get
This API detects the host operating system and constructs the relevant WSMAN get 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, 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.
# Get
def wsman_get_command(classname, namespace, key_dict, username, password,
ipaddress, cert = 'dummy'):
"""
Constructs the WSMan Get Operation command based on the OS and returns
the command to be used.
Sample arguments:
key_dict = {‘classname’:’DCIM_CS’,’name’:’srv:system’}
"""
key_str = construct_key_str(key_dict)
if detect_host_os() == 1:
wsman_command = 'winrm g "http://schemas.dell.com/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'
wsman_command = wsman_command % (classname, key_str, namespace, username,
password, ipaddress)
else: