def list_vdirs(site, app=_DEFAULT_APP):
 ret = dict()
 pscmd = list()
 pscmd.append("Get-WebVirtualDirectory -Site '{0}' -Application '{1}'".format(site, app))
 pscmd.append(" | Select-Object PhysicalPath, @{ Name = 'name';")
 pscmd.append(" Expression = { $_.path.Split('/')[-1] } }")
 cmd_ret = _srvmgr(func=str().join(pscmd), as_json=True)
 try:
  items = json.loads(cmd_ret['stdout'], strict=False)
 except ValueError:
  _LOG.error('Unable to parse return data as Json.')
 for item in items:
  ret[item['name']] = {'sourcepath': item['physicalPath']}
 if (not ret):
  _LOG.warning('No vdirs found in output: %s', cmd_ret)
 return ret

def list_vdirs ( site , app = _DEFAULT_APP ) : ret = dict ( ) pscmd = list ( ) pscmd . append ( "Get-WebVirtualDirectory -Site '{0}' -Application '{1}'" . format ( site , app ) ) pscmd . append ( " | Select-Object PhysicalPath, @{ Name = 'name';" ) pscmd . append ( " Expression = { $_.path.Split('/')[-1] } }" ) cmd_ret = _srvmgr ( func = str ( ) . join ( pscmd ) , as_json = True ) try : items = json . loads ( cmd_ret [ 'stdout' ] , strict = False ) except ValueError : _LOG . error ( 'Unable to parse return data as Json.' ) for item in items : ret [ item [ 'name' ] ] = { 'sourcepath' : item [ 'physicalPath' ] } if ( not ret ) : _LOG . warning ( 'No vdirs found in output: %s' , cmd_ret ) return ret
get all configured iis virtual directories for the specified site .