• [Script of May 17] Guest user permission check for multiple databases per security best practices

    Script Download: GuestUserCheck.zip
    http://gallery.technet.microsoft.com/scriptcenter/Guest-user-permission-ac9eecdb

    This T-SQL sample script checks permissions for guest user in all databases. This script applies to system and to user databases.

    Knowing about guest user in Sql server is a frequent security requirement. This can also be a source of confusion since many a times guest user is disabled in Sql Server msdb's Sql server and results in issues indicated in below mentioned KB. 

    Some forums for such requirements are below:
    http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/04940880-85c4-419a-a859-8a6bd58a18f0 

    Such a script should also help in below mentioned KB (KB has script for single database):
    http://support.microsoft.com/kb/2539091

    You should not disable the guest user in the msdb database in SQL Server 

    Script does below:

    • Script checks that all databases (except msdb) do not have any permission per security best practice.
    • Script checks that msdb database has Connect permission for guest user.
    • Script runs in Sql 2005/2008/2008R2/2012.

     

    image image
    image

    You can find more All-In-One Script Framework script samples at http://aka.ms/onescriptingallery

  • [Script of May 16] Fix Publishing Pages which reference bad page layout within a site collection

    Script Download: FixPublishingPages.zip
    http://gallery.technet.microsoft.com/scriptcenter/Fix-Publishing-Pages-which-1e0deb22

    This script will scan all publishing pages in a given site collection and check if the pages in the pages library have a valid url for the page layout. The script runs in a “detect” mode by default and also accepts parameters which allow fixing the page layout url for pages. If the page is checked out to someone else, you can force undo of the checkout (results in changes on that page being lost). When fixing the page layout url, it will also checkout and approve the pages post fixing if moderation is enabled. It does not publish the pages.
    Having a correct page layout is important when rendering pages in publishing site or when using features such as Variations or Content Deployment because these will fail if the referenced page layout is invalid or pointing to a location which is not valid in the context of the site.
     
    In a real world, this script will help fix issues wherein
                a. Variations create hierarchies fail because the page layout is invalid.
                b. Page rendering fails because the page layout is invalid.

     

    image image
    image

    You can find more All-In-One Script Framework script samples at http://aka.ms/onescriptingallery

  • [Script of May 15] Update Owner of a Group with another Group in a Web in Microsoft SharePoint 2010

    Script Download: ScriptPack.zip
    http://gallery.technet.microsoft.com/scriptcenter/Update-Owner-of-a-Group-1a205289

    The script can be used to update Group owner of a web with another group in the same web.

    The action can be performed from UI but is often time taking if needed to be done in bulk.

     

    image image
    image

    You can find more All-In-One Script Framework script samples at http://aka.ms/onescriptingallery

  • [Script of May 14] Check SQL Server encryption certificates present without a backup issue

    Script Download: CheckEncryptionCertificates.zip
    http://gallery.technet.microsoft.com/scriptcenter/Check-SQL-Server-b328b4f6

    This script can be used to check your SQL Server encryption certificates without backup issue.

    We can use Get-OSCEncryptionCertificates to identify the certificates used in TDE (Transparent Data Encryption) which have not been backed up and then list the affected databases. By default, this script use Windows Authentication to connect to your SQL Server. If you want to use SQL Server Authentication, just uncomment some code in this script.

     

    image image
    image

    You can find more All-In-One Script Framework script samples at http://aka.ms/onescriptingallery

  • [Script of May 13] Check SQL Server average percent fragmentation using PowerShell

    Script Download: CheckSQLServerFragmentation.zip
    http://gallery.technet.microsoft.com/scriptcenter/Check-SQL-Server-average-f96a1088

    This script can be used to check your SQL Server average percent fragmentation and list the fragmentation between 5 and 30 or more than 30 percent.

    By default, we can use New-OSCSqlConnection to create a SqlConnection and then use Get-OSCFragmentationInfo to get fragmented tables. Also, you can use Windows Authentication or SQL Server Authentication to connect your SQL Server. If you want to use SQL Server Authentication, just need to uncomment some code in this script.

     

    image image
    image

    You can find more All-In-One Script Framework script samples at http://aka.ms/onescriptingallery