Writing xml with powershell

Posted by alex on Super User See other posts from Super User or by alex
Published on 2011-11-15T09:50:24Z Indexed on 2011/11/15 9:56 UTC
Read the original article Hit count: 252

i have a script that get all the info i need about my SharePoint farm :

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null

$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local 
$websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]} 
$webapps = @()

foreach ($websvc in $websvcs) { 
           write-output "Web Applications" 
           write-output "" 
    foreach ($webapp in $websvc.WebApplications) { 
        write-output "Webapp Name -->"$webapp.Name 
           write-output "" 
           write-output "Site Collections" 
           write-output "" 
    foreach ($site in $webapp.Sites) { 
        write-output "Site URL --> -->" $site.URL 
           write-output "" 
           write-output "Websites" 
           write-output "" 
    foreach ($web in $site.AllWebs) { 
        write-output "Web URL --> --> -->" $web.URL 
           write-output "" 
           write-output "Lists" 
           write-output "" 
    foreach ($list in $web.Lists) { 
           write-output "List Title --> --> --> -->" $list.Title 
           write-output "" 
    }

    foreach ($group in $web.Groups) { 
           write-output "Group Name --> --> --> -->" $group.Name 
           write-output ""

    foreach ($user in $group.Users) { 
           write-output "User Name --> --> --> -->" $user.Name 
           write-output "" 
    } 
    }

    }

    }

    } 
}

i want to make the output to an XML file and then connect the xml file to HTML and make a site of it for manager use

how can i do it ?

thanks for the help !

© Super User or respective owner

Related posts about powershell

Related posts about Xml