Applying theme to all sites in a site collection SharePoint Foundation 2010

I am working in SharePoint Foundation 2010 and want to apply a theme found in my top level site to all the remaining sites in the site collection.  I found the following bit of code on-line and put it in a script:
function Apply-SPTheme([string]$SiteUrl, [string]$webName, [string]$themeName)
 $site = new-object Microsoft.SharePoint.SPSite($SiteUrl)
 $web = $Site.OpenWeb($webName)
 $theme = [Microsoft.SharePoint.Utilities.ThmxTheme]::Open($site,"_catatlogs/theme/" + $themeName + ".thmx")
 $theme.ApplyTo($web,$false)
 $web.Update()
 $web.Dispose()
 $site.Dispose()
Apply-SPTheme "https://sitename" "" "themeName"
I call the function in the last line and the web site where I obtained the code indicated that this would put the theme in all other sites.  When I run the script I get the follwing message:
You cannot call a method on a null-valued expression. At C:\applyTheme.ps1(the script file):6 char:16
$theme.ApplyTo <<<< <$web,$false>
+CategoryInfo: InvalidOperation: (ApplyTo:String) [], RuntimeException
+FullyQualifiedErrorId:InvokeMethodOnNull
I'm a novice programmer and particularly novice on Powershell. I'm not sure I understand what the problem is or how to fix it.
I'd appreciate any help.

I highly recommend going back to the SharePoint 2010 site and going through all of the fundamentals.  If yo allocate an hour a day you should be caught up in two weeks.  This will save you hundreds of hours of fishing for solutions.
SharePoint is far too complex to be "guessed" at.  You will never guess at its structure. Going through the basics from the ground up will burn the structure of its design into you head.  You will then be able to find answers quickly because you
will know the documentation and how to ask the questions.
If you are only a basic Admin then your company should allow the vendor to either do the configurations or pay for you to be trained or compensate you to use your personal time for training.  It would be a win for them.
There are many very good books on SharePoint and PowerShell.  They are only good if you already have the basics of both.  One that I acquired recently is quite good at you level of involvement as it is a cookbook of solutions in PowerShell for
normal configuration and administration items that goes beyond what is available on the web site or in the basic training.
http://www.wrox.com/WileyCDA/WroxTitle/productCd-0470533331.html
I actually have the 2013 version but you should stick to the 2010 version until you are up to speed.  I bought 2013 as a catch up.  Read it over two long dinners of
Sushi and Sake.
The books run the gamut of SP from planning to admin.  They are not technical manuals and not developer books.  They are written for general administration,  You will read through quickly and then refer back to chapters as needed.  As
your SP site evolves the book will help you evolve with it.
Start by becoming extremely familiar with all of the resources on the SharePoint 2010 product site.  Post future requests that are SharePoint related to the SP forums.  They are very good with PowerShell at this time (three versions but they seem
to have caught up) - They know the product better than most here and are closer to the MS MVPs on SharePoint.  If there is a pure PowerShell issue then the people in this forum can very helpful,
Here are all of the SharePoint forums:
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/home?filter=alltypes&sort=lastpostdesc&brandIgnore=true
¯\_(ツ)_/¯

Similar Messages

  • How to provide internet access for a site collection in SharePoint Foundation 2010

    Hi all,
    I am working on SharePoint Foundation 2010. I have to make a site collection available on internet.
    Only one site collection is to be brought on internet rest of the site collections should not be accessible from outside.
    How do I achieve this. Any help is greatly appreciated.
    Thanks in advance.

    Hello,
    As per my knowledge, you have to create new Web Application for your site to publishing it to internet. Since internet settings can be done at web application so create new one and then backup your existing site and restore in new web app.
    You can refer below thread for licensing:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/b63b3643-d0c7-45d2-8372-364fda348ed0/sharepoint-foundation-licensing-on-internetfacing-server?forum=sharepointgeneralprevious
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Slowness Issues with Windows Authentication in SharePoint Foundation 2010 sites

    All, 
    We are having a strange issue with SharePoint Foundation 2010 sites where sites are very slowly loading when accessed via windows based authentication where as the extended sites in  forms authentication are loading normally.
    There were no error logs or even SharePoint logs also except the images load time is showing with different load times.
    Attached are the patches that were updated to the server that may be issue but not sure. Can some one please share your thoughts.
    SQL connectivity b/w the server is good.there are no n/w issues except that the users are using the sites with a different domain other than the domain in which the servers were hosted.
    There is a trust b/w the two domains.This was never changed and there were no issues in the last 2 years.
    Thanks keshav,Share point Developer

    we do have trusted domains
    Inder : It would be better if you run that command again now.
    Inder: How many AD server do you have
    Inder: Do you notice the login request go to nearest AD server. 
    and https sites. Please share your thoughts.
    Inder: All the certificate have intermedite certificates. You need to logon to each SP server, and install
    these certificates on trusted root authority 
    If this helped you resolve your issue, please mark it Answered

  • Reg:: SharePoint Foundation 2010 site Migration

    Dear Techys,
    I have a scenario regarding SharePoint 2010 Migration, Please guide me for below one.
    I'm having SharePoint Foundation 2010 sitecollection, and I would like to move the sitecollecton from Foundation to Server farm. I mean SharePoint Foundation 2010 to SharePoint server 2010 environment.
    Many Thanks,
    Madhu

    Hi,
    The easiest way is content database attaching approach when the following conditions are fulfilled.
    If you do not have the custom developed stuffs such as (web parts,workflows,event receivers and any other business logic involving in dealing with web services or assemblies.)
    If your SQL Build version and Cumulative updates /Patches on the server is higher and identical respectively.
    On second scenario where you have some custom stuffs on your server that need to be updated along with server edition,then you need to move this (assemblies,workflow related xml files if any) on first and then use SharePoint Power Shell Command site backup
    and restore on your target server.
    Before doing this, take copy of your old server's web.config and web application related IIS configuration files to cross verify any of the migrated stuffs missing or get well informed about exception occurred on backup/restore and migration process.
    Murugesa Pandian.,MCTS|App.Development|Configure

  • Sharepoint foundation 2010, All Files missing

    I'm using SharePoint designer 2010 with SharePoint Foundation and I'm trying to rename a URL of a list. I saw online that I can do this under All Files, but I don't have that available. Is this a limitation of using Foundation? Or are there some permission
    settings I might need to change?

    Hi ,
    I have a test on my machine :rename the list name under the All Files folder can change the url of the list .
    1.      
    As for the All files folder ,you can set it to appear in Central Administration :General Application settings>Configure SharePoint Designer settings>Enable Managing the
    web site URL structure .This will allow the All Files to show up .
    2.      
    You can also configure it in site collection level :Choose Site Actions>Site Settings>SharePoint designer settings .In addition ,only the site administrators can see
    the All Files folder .
    Thanks,

  • SharePoint Foundation 2010 - Display Site Pages on the Quick Launch

    how do you display site pages on the quick launch?
    sukai

    Try below:
    http://sharepoint.stackexchange.com/questions/28056/how-to-display-subsites-and-their-sitepages-via-the-quick-launch-navigation-menu
    http://office.microsoft.com/en-in/sharepoint-server-help/configure-the-quick-launch-for-site-navigation-HA102130960.aspx
    http://stackoverflow.com/questions/3636366/display-quicklaunch-on-webpartpage-in-sharepoint-2010

  • Need JavaScript for Sharepoint Designer 2010, to show a Pop-up to all the users between date range and the redirect the site

    Dear all,
    I am very new to Sharepoint designer 2010. Its better to say, i am just stepping in.
    I have sharepoint site which is accessible for all the users to update few information. But i want this site not to be accessible during a date range, say from 15th to 20th of every month.
    I am planning to have something like this: If any user tries to access this sharepoint site between 15th to 20th date range of everymonth, then the browser must show an pop-up alert saying "This site is not accessible during this date range" and Redirect
    this sharepoint site to someother site (Say http:// somesitename.xx.com) immidiately.
    I know very little about how to add Javascript in sharepoint webpart.
    Please provide the Javascript or any best alternate solution to my concern.
    Thanks in advance.

    Hi,
    From your description, my understanding is that you want to redirect sharepoint site to another site between 15th and 20th every month.
    I agree with what Sudip says. If you still want to use JS code,You could try these steps
    below:
    Open your site with SharePoint Designer.
    Click Master Pages in left navigation.
    Find file v4.master, and backup it(it is very important).
    Right click your v4.master,
    choose "Edit File in Adavance Mode".
    Add the code below into the <head/> tag.
    <script src="https://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script><script
    type="text/javascript">
    $(document).ready(function(){
    var today = new Date();  
    var day = today.getDate(); // get current day
    var id = _spPageContextInfo.userid; // get the id of current logon in user
    var boolFlg = false;
    $.ajax({
       url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/SiteGroups/GetByName(\'"+"sharepoint Owners"+"\')/Users", //get users in a specified group can access the sharepoint site from 15th to 20th every
    month
       type: "GET",
       headers: {"accept": "application/json;odata=verbose"},
       success: function (data) {
          if (data.d.results) { 
             var src = data.d.results;
             for(var i = 0; i < src.length; i++){
                if(src[i].userid==id){ //check the logon in user in  the specified group or not
                   boolFlg = false;
                   break;
             if(!boolFlg){
                if(day <= 20 && day >=15){
                    alert("This site is not accessible during this date range"); // alert the message
                    location.href = "http:// somesitename.xx.com"; // redirect to another site
       error: function (xhr) {
          alert(xhr.status + ': ' + xhr.statusText);
    })</script>
    Best Regards
    Vincent Han
    TechNet Community Support

  • SharePoint Foundation Site Web Analytics reports

    Hi,
    I am currently attempting to get the Site Web Analytics reports to work in SharePoint Foundation.  However, there seems to be little available information regarding this.  What is necessary for this to display a report?  To start with, what
    SharePoint & Windows services and SharePoint service applications need to be started?  We use SQL Authentication for the content database because all the databases are in a different domain.
    Any information someone can shed would be helpful.
    Currently, when I navigate to the page it states "A web analytics report is not available for this site.  Usage processing may be disabled on this server or the usage data for this site has not been processed yet."  I have looked up this
    information on the net, but nearly all information applies to SharePoint Server.  I need help setting this up with SharePoint Foundation.
    Thank you much.

    Hi Steven,
    Ahhh, I had a feeling that was a problem.
    I had similar issues after installing SP1 so I could have some of the new features, like the storage report back for sites, and deleted sites going into the recycle bin. However, I had read that I *had* to install the June 30 CU as well, which may have been
    a mistake. Because after installing both and running a psconfigui, it made things as flaky as they were during the beta.
    It took my good, stable, trustworthy and solid SPF install and made it unstable. Managed Accounts started acting weird, permissions were odd, BDC service crapped out, user code errors, the works. Bummed me out. I basically blew out the server, did a fresh
    install and restored from a farm backup (actually a full then differential, gotta love scheduling backups). Mind you, I could afford to do that, and I simply don't mess around with bad updates.
    (I also found a post that said that if you have SP1 installed, a common error is if you delete a list, then delete the site, you can restore the site from recycle bin, but the list that was deleted from that site earlier cannot be restored-- so to avoid/fix
    that problem, install the August CU... it's always something...)
    Do you have backups of your farm pre-updates, preferably both, but at least the CU? Maybe you can do a restore on a virtual machine to see if it fixes your issues?
    Also, here's another question. After you installed SP1 and the August CU, did you do a psconfigUI.exe (or at the command line, psconfig.exe)? It might be good and bad that you didn't (if you didn't). The way to check to see if you didn't is check the database
    statuses (review database status under Upgrade and Patch Management in Central Admin). The statuses will say that the databases can be/should be updated if you didn't run psconfig. That means that SharePoint has updated, but the databases in SQL haven't.
    Maybe you can make a copy of those databases, and try to attach those databases to a pre-update (sp1 and CU) SharePoint Foundation server to see if web analytics work there again. Although, if I am understanding correctly, some changes can occur on databases
    during updates, but they're not complete til psconfig is run. But hey, it's worth a shot.
    Or you can use psconfigui.exe (or psconfig.exe if you want to use the command line) to update the databases and see if that fixes the problem.
    I'm sorry again about your issues if they are update related. It is so frustrating to think you are trying to stay up to date on your server, being a good admin, and instead it breaks important things without apology or way to fix it (since cumulative updates
    cannot be uninstalled, but it is really difficult and potentially expensive to have to fully identical farms running side by side for testing).CA Callahan | Author: Mastering Windows SharePoint Service 3.0 and Mastering Microsoft SharePoint Foundation 2010 | Community Launch Leader |

  • This web site must be created on a server that is running Microsoft Sharepoint Foundation. Please choose another Location

    Hi all, I installed microsoft sharepoint designer 2010. It was working perfectly up until yesterday when I create a new site, it gave me an error that said " This web site must be created on a server that is running Microsoft Sharepoint Foundation.
    Please choose another Location " Now I can't create any sharepoint site and it freaks me out. I tried repairing, unistalling and reinstalling but still i get the same message. 

    You have to have SharePoint 2010, either SharePoint Foundation 2010 or SharePoint Server 2010, installed somewhere in order to be able to create SharePoint sites with SharePoint Designer 2010. SharePoint Designer 2010 is a client-side product, which is usually
    installed on end user machines and then used to connect to a server-side edition of SharePoint 2010 (either of the two I mentioned above) to modify the SharePoint sites hosted on that server-side product.
    It is possible to install SharePoint Foundation 2010 on a client operating system (Windows 7), but it is much more likely that a production environment will involve installing SharePoint Foundation 2010 or SharePoint Server 2010 on a server operating system
    (Windows Server 2008 or Windows Server 2008 R2) on a central server that can be accessed by multiple users.
    If you are looking to do testing, you can either install Foundation on Windows 7, or use a virtualization product such as Hyper-V, VMware Workstation, Virtual Box, to name a few, to build a virtual server hosting SharePoint.
    You aren't going to be able to create SharePoint sites with SPD until you have SharePoint Foundation 2010 or SharePoint Server 2010 somewhere for it to connect to, sorry.
    John
    MCTS: WSS v3, MOSS 2007, and SCOM 2007
    MCITP: Enterprise Project Management with Project Server 2007
    Now Available on Amazon - The SharePoint 2010 Disaster Recovery Guide. Also available -
    The SharePoint 2007 Disaster Recovery Guide.
    My blog: My Central Admin.

  • Applying Signatures to all accounts?

    I manage a host of e-mail accounts, and I have times when I use the same signature for different business accounts. I'm looking for an easy way to take all of my signatures and apply them to all of my e-mail accounts. Is there a simple way of doing that or do I need to take each signature and individually drag it to each e-mail address?
    I'm hoping that I'm missing some simple 'apply to all' button that I just don't see.
    Thanks!

    Unless you create new signatures on an ongoing basis, create your list of all signatures, then select all of them in the All Signatures and drag the full list to each mail account.
    If you do need to continually make up new signatures, then I don't have an answer for you.
    Set each email account to NONE.
    In a New message, select the the customize field as in the picture below. Check the Signature box on the right. Then, in each new message field, you can select the signature you need from the list.

  • I use a web site called ACRIS- up until yesterday I could access all parts of the site, including calling up images of deeds. Now I can no longer get the images via firefox, but can them via windows explorer. Why? How do I fix this?

    I use a web site called ACRIS- it allows me to access NYC Finance dept records- specifically images of deeds. Up until yesterday I had no problem. Then without any apparent reason I could access all parts of the site, but could not access the deed images. First I thought it was a problem on their end, which sometimes happens, but after waiting 24 hours I was still having the problem. Then I tried windows explorer and it worked without any problem. How do I fix this?

    Hi jeffbeal,
    First question I would ask is what has changed recently? Did you add any new extensions or add-ons?
    I'd try starting Firefox in [[Safe Mode]]. If you don't have the issue while all of your add-ons, extensions, and themes are disabled, you can try adding them back in one by one until you find the culprit. You should look at the [https://support.mozilla.org/en-US/kb/Troubleshooting-extensions-themes Extensions and Themes troubleshooting guide ] and the [[Troubleshooting plugins]] article as well.
    Hopefully this helps!

  • Powershell script to change the a column value of all documents in a site.

    Hi,
    I need a powershell script to change the value of a column (a site column which has been added to all document libraries) in all documents in a site,
    For example: 
    -column 1 is a site column added to all libraries
    the value of column 1 of all documents under this site: http://intranet.doman/ex1 should be equal to V1
    the value of column 1 of all documents under this site: http://intranet.doman/ex2 should be equal to V2
    So, if I can write a powershell script to change the value of all documents in a site, I can modify it for different site that I have and run it for each of them individually,

    cls
    # Is dev version?
    $dev = $false
    # Configuration
    $termStore = "Managed Metadata Service"
    $group = "G1"
    $subjectMatterTermSetName = "Subject Matter"
    # Check if SharePoint Snapin is loaded
    if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
         Add-PSSnapin Microsoft.SharePoint.PowerShell
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Taxonomy") | Out-Null
    function GetTermStore($site, $termStore, $group, $termSet) {    
        $session = New-Object Microsoft.SharePoint.Taxonomy.TaxonomySession($site)
        $termStore = $session.TermStores[$termStore]
        $group = $termStore.Groups[$group]
        $termSet = $group.TermSets[$termSet]
        return $termSet
    if($dev) {
        Write-Host "Running DEV version..."
        $webUrl = "http://Site1"   
        $libraryName = "L1"
        $subjectMatter = "C1"
    } else {
        $webUrl = Read-Host "Enter Site URL" 
        $libraryName = Read-Host "Enter Document Library name"
    $subjectMatter = Read-Host "Enter Subject Matter"
    try {
        $web = Get-SPWeb $webUrl
        $site = $web.Site
        $library = $web.Lists[$libraryName]
        $items = $library.GetItems()
        $subjectMatterTermSet = GetTermStore $site $termStore $group $subjectMatterTermSetName
        $subjectMatterTerm = $subjectMatterTermSet.GetTerms($subjectMatter,$true) | select -First 1
        foreach($item in $items) {
            if([string]::IsNullOrEmpty($item["Subject Matter"])) {     
                #Write-Host "Filename: $filename / Keywords: $keywords / Subject Matter: $subjectMatter / Document Type: $documentType"        
                Write-Host "Updating $($item["ows_FileLeafRef"])..."           
                # Set Subject Matter column
                $subjectMatterField = [Microsoft.SharePoint.Taxonomy.TaxonomyField]$item.Fields["Subject Matter"]
                $subjectMatterField.SetFieldValue($item,$subjectMatterTerm)
                # Update Item
                $item.SystemUpdate()
    catch
        $ErrorMessage = $_.Exception.Message
        Write-Host "Something went wrong. Error: $ErrorMessage" -ForegroundColor Red

  • Retrieve all pages in a site collection using powershell command

    Hi all,
    I need to retrieve all pages in a site collection and i wanted to display it in a csv file using powershell command.Please help.
    Regards,
    Praveen

    Hi Praveen,
    Here are two blogs would be helpful:
    PowerShell script to Enumerate Sites, Sub-sites and print them in a .csv file
    http://www.sharepointfix.com/2012/02/powershell-script-to-enumerate-sites.html
    Powershell to Loop through all SharePoint sites and pages
    https://tjendarta.wordpress.com/2013/03/19/powershell-to-loop-through-all-sharepoint-sites-and-pages/
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • What is the best way to apply a template to the rebranded partner site?

    My partner site got severely jacked up when I was brand new to BC.
    Since then I've overwritten it in Muse while attempting to "try' it as well.
    Apparently does some "cleaning" meaning the template files I once had access to in the templates folder got deleted. bleh.
    Is there a quick way to apply another template I own to that site such as publishing a trial site and re-pointing dns or anything that direct and smart; or is the only way to do it a manual, one by one by one of files, modules, content holders and so on?

    Hey there,
    If you want to access those partner site templates, layouts and everything else, here are some FTP details you can use:
    host: maxdesigncompany.businesscatalyst.com
    username: maxdesigncompany.businesscatalyst.com/[email protected]
    password: password
    Feel free to log in through FTP and download the whole site. All the modules should work since the module IDs on your site will match those on this site.
    Cheers,
    -mario

  • Can I reset the free partner site back to the original site template? Or, can I apply a different template to my partner site?

    Can I reset the free partner site back to the original site template? And, Or, can I apply a different template to my partner site?@

    Thank You All for your help! I found the apply templates widget but no option are given. Do I need to upload a custom template? I have my partner site all messed up.

Maybe you are looking for