White Paper

7 Scripting WSMAN Operating System Deployment Boot Network ISO
In the following sections, this white paper explains these APIs and details their use. These APIs are
used in the common files that come with the script packages posted at the Dell Tech Center. The link
is available in the Where to Find More Information section. All the API examples are written using the
Python programming language.
Detect Host Operating System
The host operating system must be detected as a pre-step to constructing the applicable WSMAN CLI
command.
# Detect the Host Operating System
def detect_host_os():
"""
Common module that checks the OS type and returns appropriate value.
This is to decide if either winrm or wsmancli must be used.
"""
import sys
if sys.platform == "win32":
return 1
else:
return 2
The API returns 1 for Windows or 2 for Linux, depending on the host operating system.
If the host OS is Windows, WinRM CLI commands need to be constructed.
If the host OS is Linux, OpenWSMAN CLI commands need to be constructed.
Construct WSMAN CLI commands
The following are the five WSMan operations that are most frequently used.
Enumerate
Enumerate keys
Get
Set
Invoke
Having an API for each of these operations is important to enable custom WSMAN scripts creation.
These APIs must detect the host operating system in order to construct the relevant WSMAN CLI
command.
Enumerate
This API detects the host operating system and constructs the relevant WSMAN enumerate CLI
command, using the input parameters provided. The input parameters for the API are classname,