Merge pull request #6006 from ranl/develop

cli examples for rdp and win_servermanager modules
This commit is contained in:
David Boucha 2013-07-07 00:32:58 -07:00
commit f012d31b37
2 changed files with 29 additions and 0 deletions

View File

@ -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 }"'

View File

@ -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) )