Posts

Showing posts from April, 2012

Uncheck read only file for all sub folder with PowerShell

Image
This time I'll introduce PowerShell code that disables the read only for all the files in sub folders ( Recurse) The code: $ Path = "your root folder" $ Files = Get-ChildItem $Path -Recurse ForEach  ($ File in $ Files ) {    Write-Host   "File: "  $ File  "IsReadOnly: "  $ File .IsReadOnly    if ($ File .Attributes -ne "Directory" -and $ File .Attributes -ne "Directory, Archive" )    {        if  ( $ File .IsReadOnly -eq  $ true  )       {            try             {                Set-ItemProperty - path  $ File .FullName  - name IsReadOnly - value $ false                write-host  "file:"   $ File .FullName "is now false read only"  -foregroundcolor "magenta"      ...

System.Web​.HttpUnhan​dledExcept​ion: Failed to load viewstate

Image
Event: Getting error while loading control - the GridView in CreateChildControl that uses ViewState Error: System.Web.HttpUnhandledException: Failed to load viewstate . The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request. The solution: Transfer the load of the ViewState to PreRender (from CreateChildControl) The lesson: Better understand the life-sycle of loading (seems that no matter the experience, are always making mistakes of a beginner :) ...) Cheers, Roi

SharePoint 2010: Set session timeout on an FBA enabled site

One of the problems SharePoint 2010 when trying to work on Forms Based Authentication (FBA), all the settings in IIS (and web.config) enable sessions of not working. After researching on google, I realized it was a problem in SP 2010. There are many blogs that give code that fixes the problem by correcting the global.asax . I checked and indeed it works, but it does not seem the ultimate solution. Best solution is (for me) working on SharePoint 2010 SP1 . A code of PowerShell . Code: $sts = Get-SPSecurityTokenServiceConfig $sts.LogonTokenCacheExpirationWindow = (New-TimeSpan –minutes 20) $sts.WindowsTokenLifetime = (New-TimeSpan –minutes 20) $sts.FormsTokenLifetime = (New-TimeSpan -minutes 20) $sts.Update() Iisreset You can change the 20 minutes, of course. Hope I helped, Roi

Custom Timer Jobs: func FeatureActivated Access denied

Things worked in the past - do not work more And today issue timer job At MOSS 2007 on the timer job worked, and Today at SharePoint 2010 the timer job runs on owstimer.exe and get an error that the timer job does not work The Error Message: The description for Event ID 0 from source Application can not be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer. If the event originated on another computer, the display information had to be saved with the event. The following information was included with the event: Custom Timer Jobs: func FeatureActivated Access denied . The solution - PowerShell Run this code: $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService # turn off remote administration security $contentService.RemoteAdministratorAccessDenied = $false # update the web service $contentS...