def _srvmgr(func, as_json=False):
 command = 'Import-Module WebAdministration;'
 if as_json:
  command = '{0} ConvertTo-Json -Compress -Depth 4 -InputObject @({1})'.format(command, func)
 else:
  command = '{0} {1}'.format(command, func)
 cmd_ret = __salt__['cmd.run_all'](command, shell='powershell', python_shell=True)
 if (cmd_ret['retcode'] != 0):
  _LOG.error('Unable to execute command: %s\nError: %s', command, cmd_ret['stderr'])
 return cmd_ret

def _srvmgr ( func , as_json = False ) : command = 'Import-Module WebAdministration;' if as_json : command = '{0} ConvertTo-Json -Compress -Depth 4 -InputObject @({1})' . format ( command , func ) else : command = '{0} {1}' . format ( command , func ) cmd_ret = __salt__ [ 'cmd.run_all' ] ( command , shell = 'powershell' , python_shell = True ) if ( cmd_ret [ 'retcode' ] != 0 ) : _LOG . error ( 'Unable to execute command: %s\nError: %s' , command , cmd_ret [ 'stderr' ] ) return cmd_ret
execute a function from the webadministration ps module .