• [Script Of July 31] How to rebuild or reorganize indexes in a specified SQL server database

    image image
    July
    31
    image

    Script Download:  
    The script is available for download from http://gallery.technet.microsoft.com/How-to-rebuild-or-12b01775.  You can also use Microsoft Script Browser for Windows PowerShell ISE to download the sample with one button click from within your scripting environment. 

    This PowerShell script sample shows how to rebuild or reorganize indexes in a specified database.

    This script will list all the indexes in a database. We can choose to rebuild or reorganize the indexes according to their defragmentation. If avg_fragmentation_in_percent_value is higher than 30 and page_cout is more than 1000, we can rebuild the indexes. If avg_fragmentation_in_percent_value is between 5 and 30 and page_count is more than 1000, we can reorganize the indexes.

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

  • [Script Of July 30] How to find logins without user mapping in a specified SQL Server database

    image image
    July
    30
    image

    Script Download:  
    The script is available for download from http://gallery.technet.microsoft.com/How-to-find-logins-without-5dd0311f.  You can also use Microsoft Script Browser for Windows PowerShell ISE to download the sample with one button click from within your scripting environment. 

    This PowerShell script will demo how to find all the logins without user mapping in a specified SQL Server database. Besides, it will list all the users and logins, except for server roles and server principals with names enclosed by double hash marks ?#?which are for internal system use only.

    Some people may encounter an error "The login already has an account under a different user name" when creating a user account for a specified database. So they need to create a user with another login. If there are many logins, it is not easy for them to try one by one. It will be better if there is a script to find all the available logins.

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

  • [Script Of July 29] How to check SQL Server database backup sets marked as damaged

    image image
    July
    29
    image

    Script Download:  
    The script is available for download from http://gallery.technet.microsoft.com/How-to-check-SQL-Server-b14d9b82.  You can also use Microsoft Script Browser for Windows PowerShell ISE to download the sample with one button click from within your scripting environment. 

    This PowerShell script will demo how to check if the latest database backup sets among all the databases in an instance are marked as damaged.

    As some people want to know if a latest database backup set is damaged or not before they restore a database to avoid giving up restoring halfway, it is nice if we can provide a script to do this.

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

  • [Script Of July 28] How to retrieve a list of Active Directory Users based on Display Names

    image image
    July
    28
    image

    Script Download:  
    The script is available for download from http://gallery.technet.microsoft.com/How-to-retrieve-a-list-of-da0fa284.  You can also use Microsoft Script Browser for Windows PowerShell ISE to download the sample with one button click from within your scripting environment. 

    This PowerShell Script sample shows how to get a list of active directory Sam Account names based on display names.

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

  • [Script Of July 25] How to retrieve the IP Address from multiple virtual machines

    image image
    July
    25
    image

    Script Download:  
    The script is available for download from http://gallery.technet.microsoft.com/How-to-retrieve-the-IP-5781fc88.  You can also use Microsoft Script Browser for Windows PowerShell ISE to download the sample with one button click from within your scripting environment. 

    This PowerShell script shows how to get the IP address from virtual machines.

    IT admins usually maintain multiple virtual machines. Getting the IP addresses of multiple virtual machines is not convenient.Using this script can easily to maintain and check virtual machines' info.

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