Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6918693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:53:33+00:00 2026-05-27T09:53:33+00:00

I am trying to create a site map with a PowerShell command from this

  • 0

I am trying to create a site map with a PowerShell command from this example:
http://blogs.msdn.com/b/opal/archive/2010/04/13/generate-sharepoint-2010-sitemap-with-windows-powershell.aspx

My actions: I copied the code into a file named New-SPSiteMap

I opened the PowerShell and wrote

New-SPSiteMap –Url http://centerportal –SavePath C:\inetpub\wwwroot\wss\VirtualDirectories\80\sitemap.xml

The error I get is:

The term 'New-SPSiteMap' is not recognized as the name of a cmdlet, 
function, script file, or operable program. Check the spelling of the name, 
or if a path was included, verify that the path is correct and try again.
At line:1 char:14
+ New-SPSiteMap <<<<  -Url http://mossdev2010  -SavePath C:\inetpub\wwwroot\wss\VirtualDirectories\80\sitemap.xml
+ CategoryInfo          : ObjectNotFound: (New-SPSiteMap:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:53:34+00:00Added an answer on May 27, 2026 at 9:53 am

    In order to have the New-SPSiteMap function available you have to execute the script containing the function:

    & .\New-SPSiteMap.ps1
    New-SPSiteMap –Url http://centerportal –SavePath C:\inetpub\wwwroot\wss\VirtualDirectories\80\sitemap.xml
    

    Alliteratively, you could turn the PowerShell script into a “function” that is callable like this:

    .\New-SPSiteMap.ps1 -Url http://centerportal –SavePath C:\inetpub\wwwroot\wss\VirtualDirectories\80\sitemap.xml
    

    All you have to do is remove the function declaration function New-SPSiteMap:

    param($SavePath="C:\inetpub\wwwroot\wss\VirtualDirectories\80\SiteMap.xml", $Url="http://sharepoint")
    
    function New-Xml
    {
        param($RootTag="urlset",$ItemTag="url", $ChildItems="*", $SavePath="C:\SiteMap.xml")
    
        Begin {
            $xml="<?xml version=""1.0"" encoding=""UTF-8""?>
            <urlset xmlns=""http://www.sitemaps.org/schemas/sitemap/0.9"">"
        }
        Process {
            $xml += " <$ItemTag>"
            foreach ($child in $_){
            $Name = $child
            $xml += " <$ChildItems>$url/$child</$ChildItems>"
        }
            $xml += " </$ItemTag>"
        }
        End {
            $xml += "</$RootTag>"
            $xmltext=[xml]$xml
            $xmltext.Save($SavePath)
        }
    }
    
    $web = Get-SPWeb $url
    $list = $web.Lists | ForEach-Object -Process {$_.Items} | ForEach-Object -Process {$_.url.Replace(" ","%20")}
    
    # excludes directories you don’t want in sitemap. you can put multiple lines here:
    
    $list = $list | ? {$_ -notmatch "_catalogs"} 
    $list = $list | ? {$_ -notmatch "Reporting%20Templates"} 
    $list = $list | ? {$_ -notmatch "Reporting%20Metadata"} 
    $list | New-Xml -RootTag urlset -ItemTag url -ChildItems loc -SavePath $SavePath
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create tiny urls like this: site.com/abc123 goes to: site.com/index.php?token=abc123 but I
I am trying to create Lists in Sharepoint site from my ASP.NET code using
I'm trying to create a sitemap in an ASP.NET MVC project. This code in
I'm trying to create an XML sitemap using CakePHP, from a table which has
I'm playing with the ASP.NET MVC Framework, trying to create a simple site. My
I am trying to create a sidebar for a site that will allow a
I'm trying to create user profiles for my site where the URL is something
I'm trying to create a Palm OS app to check a web site every
i'm trying to create downloadable video-files. In my site there is a list of
just signed up my site with Google Webmasters and im trying to create a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.