Share via


Export Enterprise Resource Details from PWA Using PowerShell

$PWAUrl = "<PWA Site Url>";
$EnterpriseResources=@();
$resSvcEndPt = [string]::Concat($PWAUrl,"/_vti_bin/psi/resource.asmx?wsdl");
$resSvc = New-WebServiceProxy $resSvcEndPt -UseDefaultCredential;
$resSvc.ReadUserList("All").Resources|%{
$resource = $_;
$res = $resSvc.ReadResource($_.RES_UID);
#A Resource can contain multiple rates with different effective dates
$res.ResourceRates|%{
$hash = @{
ResourceUID = $resource.RES_UID.ToString();
ResourceName = $resource.RES_NAME;
WindowsAccount = $resource.WRES_ACCOUNT;
ResourceRateTable = $_.RES_RATE_TABLE;
ResourceEffectiveDate = $_.RES_RATE_EFFECTIVE_DATE;
ResourceStandardRate = $_.RES_STD_RATE;
ResourceOvertimeRate = $_.RES_OVT_RATE;
ResourceCostPerUse = $_.RES_COST_PER_USE;
}
$entRes = New-Object PSObject -Property $hash;
$EnterpriseResources += $entRes;
}
}
$EnterpriseResources|select ResourceUID,ResourceName,WindowsAccount,ResourceRateTable,ResourceEffectiveDate,ResourceStandardRate,ResourceOvertimeRate,ResourceCostPerUse|Export-CSV "D:\SharePoint Administration\PWAEnterpriseResources.csv" -NoTypeInformation;