My good friend Jeremy shared this simple WMI fix.
Winmgmt/?
Winmgmt /backup filename
Winmgmt /verifyrepository
if that fails, try
Winmgmt /salvagerepository
[if that fails, as a last resort:]
[Winmgmt /resetrepository]
My good friend Jeremy shared this simple WMI fix.
Winmgmt/?
Winmgmt /backup filename
Winmgmt /verifyrepository
if that fails, try
Winmgmt /salvagerepository
[if that fails, as a last resort:]
[Winmgmt /resetrepository]
Sharepoint has two state service commands that threw me for a loop
first there is get-SPSessionStateService
then there is get-SPStateServiceApplication
Here’s an article from MSDN that talks about the differences
http://blogs.msdn.com/b/markarend/archive/2010/05/27/using-session-state-in-sharepoint-2010.aspx
In Central Admin->Manage Service Applications these show up as follows:
Get-SPSessionStateService -> shows as type “SharePoint Server ASP.NET Session State Service”
Get-SPStateServiceApplication-> shows as type “State Service” and hopfully “State Service Proxy”
While you can easily delete both from Central admin, you can create neither of them from the service applications page.
Creating a new SPStateServiceApplication (and proxy) is relatively easy: 3 lines of powershell:
# from http://technet.microsoft.com/en-us/library/ee704548.aspx
$serviceApp = New-SPStateServiceApplication -Name ""
New-SPStateServiceDatabase -Name "" -ServiceApplication $serviceApp
New-SPStateServiceApplicationProxy -Name "" -ServiceApplication $serviceApp -DefaultProxyGroup
Creating a new SPSessionStateService, on the other hand is a little more involved…
How do I know?
I’m glad you asked….
I ran into an issue where an access report would not display because “session state is not turned on” it didn’t say which one, and through some trial and error, I now understand it was likely looking for the service returned by get-SPSessionStateService.
For me that returned a blank line with no database entry so I thought I’d be best to delete it and recreate it from scratch.
I was wrong.
While deleting and recreating the SPStateServiceApplication is easy, the SPSessionStateService was not easily done in SP2010 with the included powershell commands.
Fortunately I found this article: http://ikarstein.wordpress.com/2010/12/14/error-while-enabling-session-state-service-on-sharepoint-2010/ Which had the steps to recreate the service manually.
I enabled the ASP.Net state windows service, then followed the article above, stopping about half way through, before the provisioning part.
To Provision it, I used Enable-SPSessionStateService -DefaultProvision
Get-SPSessionStateService now returns a complete row, with a database server, and DB name, and ID and best of all Enabled = True
So to summarize my problem,
MS Access services reports needed “SPSessionStateService” which also uses the windows service “ASP.Net State Service”
In troubleshooting, I wasn’t aware of the difference between states so I deleted the “wrong” one in an attempt to reset it.
A little digging and I now have a better understanding of the issue and of the two different state services.
I hope this helps!
A common practice in IT is to have a separate admin account to connect to servers.
Often in day to day administration of SharePoint servers, it’s necessary to connect to the c$ or d$ share to look at a log file, copy an installer, etc…
You can do this from windows, and it will usually prompt you for credentials, but that can be a pain if you regularly connect to a bunch of machines that need different credentials.
This script will prompt you for a password, then use that password along with a pre-defined user account and server list to connect you to each server in advance.
function mapdrives
{
#Update these variables for your environment:
$account = "domainuseraccout"
$serverlist = @("Server1", "Server2", "Server3", "Etc...")
$SecurePwd = read-host -assecurestring "Enter password for $account"
$pwd = ConvertTo-PlainText($SecurePwd)
foreach ($Server in $ServerList)
{
net use \$server /d
net use \$Server /user:$account $pwd
}
write-host "Done mapping drives"
}
# This function came from Oisin Grehan, MVP
# via: http://www.vistax64.com/powershell/159190-read-host-assecurestring-problem.html
Function ConvertTo-PlainText( [security.securestring]$secure )
{
$marshal = [Runtime.InteropServices.Marshal]
$marshal::PtrToStringAuto( $marshal::SecureStringToBSTR($secure) )
}
mapdrives
Phil Childs at get-spscripts has a nice powershell script for grabbing the size of folders, subsites etc…
http://get-spscripts.com/2010/08/check-size-of-sharepoint-2010-sites.html
Get-SPSite | select url, @{label="Size in MB";Expression={$_.usage.storage}}
I needed to enable / configure BLOB caching on multiple sharepoint sites.
This is done by editing the web.config of each SharePoint site, on each SharePoint server.
I wrote this down and dirty script so I would not need to edit all the web.config’s by hand (I had about 20 web.configs to touch)
Note that since its just editing the web.config, we don’t need to run this in a SharePoint shell – I ran it from an ordinary PowerShell command prompt on my workstation.
The script:
Echo "Run this script under an admin account with rights to the servers being hit"
$dir = "\Serverc$inetpubwwwrootwssVirtualDirectories"
$currentDate = (get-date).tostring("mm_dd_yyyy-hh_mm_ss")
# loop through each subdirectory to find each sharepoint site.
foreach ($subdir in dir $dir)
{
# Here In my case, all my SharePoint sites had mydomain.com as part of the folder names,
# So the contains statement was an easy way to only touch the web.config's of actual SharePoint sites
# while leaving alone central admin and other non-SharePoint websites IIS had.
if($subdir.Name.Contains("mydomain.com"))
{
$path = $dir + "" + $subdir.name + "Web.config"
echo $path
$backup = $path + "_$currentDate.bak"
$xml = New-Object XML
$xml.Load($path)
$xml.Save($backup)
$element = $xml.configuration.SharePoint.BlobCache
echo $element
$element.location = "X:BlobCache14"
$element.enabled = "true"
$element.maxSize = "5"
echo $element
$xml.Save($path)
}
}
Over on my old Blog, Basementjack.com, Remco de Groot commented that this isn’t the best way to change a web.config in SharePoint and he’s absolutely right!
He sent over a script from
http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/14/use-powershell-to-script-changes-to-the-sharepoint-web-config-file.aspx
The article above does a great job of explaining the new script and is a must read. In summary, it uses SharePoint to make the change, and this is a huge help down the line if you ever need to add or replace a SharePoint server in the farm.
I’ll leave the original post’s code above for search engines and as an example of using XML with PowerShell. That said, if you’re here to enable Blob Cache, then definately head on over to the article above
If search results from SharePoint (not Fast) search are not showing the right title, and instead are showing a few words from the content of the document, theres a registry setting you can set to fix that.
The registry setting will be found on any machine running sharepoint search (Central admin-> Manage servers in this farm will show you which boxes have this role)
These powershell commands will show what the value is currently (or an error if its not found – a good sign that you’re on the wrong machine!)
$RegKey ="SOFTWAREMicrosoftOffice Server14.0SearchGlobalGathering Manager"
Cd hklm:$RegKey
$key = "EnableLastModifiedOverride"
Get-ItemProperty -path. -name $key | Select $key
$key = "EnableOptimisticTitleOverride"
Get-ItemProperty -path. -name $key | Select $key
(you can see the registry entries in the code, you can edit these manually if you’d like)
This script changes the values to 0, fixing the office 2007 issue in SP2010 search:
$RegKey ="HKLM:SOFTWAREMicrosoftOffice Server14.0SearchGlobalGathering Manager"
set-ItemProperty -path $RegKey -name EnableLastModifiedOverride -value 0
set-ItemProperty -path $RegKey -name EnableOptimisticTitleOverride -value 0
After you’re done with the above, restart the Sharepoint search service and do a full crawl – it is not necessary to reset the index.
I recently ran into a few issues installing SharePoint 2013 that can easily be avoided by installing in a given order.
Firstly for the quick install, this seemed problem free:
1) Build a new windows 2008R2 SP1 Standard edition VM
(I gave mine 3GB of ram)
1a) I joined it to a domain (I did not build the VM as a domain controller)
2) be sure you have an internet connection
3) install sharepoint 2013 preview, choose the standdalone version. (the one that will install the free version of SQL2008 R2
This seemed to work fine.
The trouble came when I tried to install it with the latest version of SQL
Here’s what I did:
(Warning: this fails!)
1) Build a new windows 2008 R2 SP1 standard edition VM
2) Install the RTM version of SQL2012 – it needed .net 4 and IIS
(I think this is where things went wrong, SQL2012 configued IIS with .net 4, not 4.5)
3) tried to run sharepoint install – it failed on the pre-reqs – it seems in my case it could not determine if IIS was setup with .net properly. I even tried the old aspnet_regiis -i command to force it but still the pre-req installer would stop at that point.
I must admin, I was in a hurry to see the new SharePoint so I didn’t take additional troubleshooting steps (I could have downloaded the rest of the prereq’s manually and tried the SharePoint install, but I did not)
Instead I figured I’d try a different approach – first I tried the install I listed at the top of this article – that worked like a champ, but I wanted the SQL2012 based install.
Next I did this:
1) new VM with Windows Server 2008 R2 SP1
2) Run the pre-req installer from the sharepoint 2013 install iso.
(this configured IIS, and ASP.net 4.5)
3) Do NOT run the SharePoint installer
4) Install SQL 2012 – since IIS and ASP.net 4.5 are already installed it should leave them alone.
5) Come back and do the SharePoint install
It’s installing now – I’ll post the results when it’s done.
The Sharepoint 2013 ‘Preview’ is out now.
I didn’t see it on MSDN yet, so here is the link:
http://technet.microsoft.com/en-US/evalcenter/hh973397.aspx?wt.mc_id=TEC_121_1_4
Also there’s some training available as well:
Developer training: http://msdn.microsoft.com/en-US/office/apps/fp123626
IT Pro Training: http://technet.microsoft.com/en-US/sharepoint/fp123606
I ran into this today –
Tagging on /_Layouts/permsetup.aspx to a site’s url brings up a list of the 3 standard groups for a site:
Today when I tried to change one through the GUI, It threw an error.
The ULS logs were a mess, and not wanting to loose a day opening a case with MS I tried PowerShell.
The solution is fairly easy.
Grab a pointer to the web in question with:
$web = get-spweb http://www.yoururl.com/sites/MainSite/subsite
You can see all the web’s properties with:
$web | fl
The 3 that we’re interested in are:
We can set these with PowerShell easily:
$web.AssociatedVisitorsGroup = $web.SiteGroups["Nameofthegroup"]
$web.update()