From 871c4f23997244830edd6627c78c713e0f271a6a Mon Sep 17 00:00:00 2001 From: ran Date: Sun, 7 Jul 2013 10:31:06 +0300 Subject: [PATCH] cli examples for rdp and win_servermanager modules --- salt/modules/rdp.py | 12 ++++++++++++ salt/modules/win_servermanager.py | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/salt/modules/rdp.py b/salt/modules/rdp.py index db13a3a54e..42c9b46edc 100644 --- a/salt/modules/rdp.py +++ b/salt/modules/rdp.py @@ -32,6 +32,10 @@ def _parse_return_code_powershell(string): def enable(): ''' Enable RDP the service on the server + + CLI Example:: + + salt '*' rdp.enable ''' cmd = 'powershell -InputFormat None -Command "& { $RDP = Get-WmiObject -Class Win32_TerminalServiceSetting -Namespace root\\CIMV2\\TerminalServices -Computer . -Authentication 6 -ErrorAction Stop ; $RDP.SetAllowTsConnections(1,1) }"' @@ -41,6 +45,10 @@ def enable(): def disable(): ''' Disable RDP the service on the server + + CLI Example:: + + salt '*' rdp.disable ''' cmd = 'powershell -InputFormat None -Command "& { $RDP = Get-WmiObject -Class Win32_TerminalServiceSetting -Namespace root\\CIMV2\\TerminalServices -Computer . -Authentication 6 -ErrorAction Stop ; $RDP.SetAllowTsConnections(0,1) }"' @@ -50,6 +58,10 @@ def disable(): def status(): ''' Show if rdp is enabled on the server + + CLI Example:: + + salt '*' rdp.status ''' cmd = 'powershell -InputFormat None -Command "& { $RDP = Get-WmiObject -Class Win32_TerminalServiceSetting -Namespace root\\CIMV2\\TerminalServices -Computer . -Authentication 6 -ErrorAction Stop ; echo $RDP.AllowTSConnections }"' diff --git a/salt/modules/win_servermanager.py b/salt/modules/win_servermanager.py index bb4d9dbb9e..5eccbd5a95 100644 --- a/salt/modules/win_servermanager.py +++ b/salt/modules/win_servermanager.py @@ -41,6 +41,10 @@ def _parse_powershell_list(lst): def list_available(): ''' List available features to install + + CLI Example:: + + salt '*' win_servermanager.list_available ''' return _srvmgr('Get-WindowsFeature -erroraction silentlycontinue') @@ -49,6 +53,10 @@ def list_available(): def list_installed(): ''' List available features to install + + CLI Example:: + + salt '*' win_servermanager.list_installed ''' ret = {} @@ -73,6 +81,11 @@ def install(feature, recurse=False): Note: Some features takes a long time to un/installation, set -t with a long timeout + + CLI Example:: + + salt '*' win_servermanager.install Telnet-Client + salt '*' win_servermanager.install SNMP-Services True ''' sub = '' @@ -92,6 +105,10 @@ def remove(feature): Note: Some features takes a long time to un/installation, set -t with a long timeout + + CLI Example:: + + salt '*' win_servermanager.remove Telnet-Client ''' out = _srvmgr( 'Remove-WindowsFeature -Name {0} -erroraction silentlycontinue | format-list'.format(feature) )