Friday, 29 April 2016

How to do IIS Reset in all the servers in a SharePoint Farm

It was awesome artcile and powersheel script has been written by Juan Carlos González on Technet,below is the URL:

I am not author for this article just posting to reach out the peoples who needed.

Summary:  This script allows to do an IIS Reset to all the servers (Web Front End and Application Servers) in a SharePoint farm (2010 and 2013 SharePoint versions). The script defines a function that uses the Get-SPServer cmdlet in order to get all the servers where the IIS reset operation

We use when we want to perform an IISRESET across an entire SharePoint farm. It’s useful if you have a large SharePoint farm.
This will take down your farm while the IISRESET is restarting the services, so it’s best to test this on a non-production environment first. Ensure you have an outage/agreed maintenance window to perform this task on a production farm.
All you got to do is spin up Power Shell on any SharePoint server in the farm and run this:

############################################################################################################################################
# This Scrip allows todo an IIS RESET to all the servers in a SharePoint Farm
# Requited parameters: N/A
############################################################################################################################################
If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{ Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell }

$host.Runspace.ThreadOptions = "ReuseThread"

#Definition of the funcion that performs the IIS RESET in all the servers
function Do-IISReset
{   
    try
    {       
        #Getting the servers where the IISReset is going to be done
        $spServers= Get-SPServer | ? {$_.Role -eq "Application"}
        foreach ($spServer in $spServers)
        {           
            Write-Host "Doing IIS Reset in server $spServer" -f blue
            iisreset $spServer /noforce "\\"$_.Address
            iisreset $spServer /status "\\"$_.Address
        }       
        Write-Host "IIS Reset completed successfully!!" -f blue 
    }
    catch [System.Exception]
    {
        write-host -f red $_.Exception.ToString()
    }
}

Start-SPAssignment –Global
#Calling the function
Do-IISReset
Stop-SPAssignment –Global

Remove-PSSnapin Microsoft.SharePoint.PowerShell


Save above file in .ps1 format and run using power shell with admin rights or windows Power shell ISE and run this file on any of App server in Farm.

Wednesday, 27 April 2016

Reset Windows Server Admin password

How to reset Windows Server Admin password

Summary:           If we forgot the domain admin password, and no other administrator exists in this Windows domain, you can use the procedure below to reset the password. Note that the screenshots are for Windows Server 2012 R2 with Update.

With this password reset method, we have to boot from a second Windows installation. Then we have to replace utilman.exe (the Utility Manager with ease-of-use functions such as the Narrator and Magnifier) on a domain controller with the command prompt (cmd.exe). Next, we’ll boot up the machine where you forgot the password, click the Utility Manager icon on the logon screen to launch a command prompt, and then reset the password. Here is the step-by-step guide:

  • Boot from a Windows Server 2012 R2 DVD (or ISO file in a virtual environment) and click Next when Windows Setup loads.


Windows Setup


  • Press SHIFT + F10 to open a command prompt.
Open command prompt in Windows Setup

  • .      At the command prompt, enter:

move d:\windows\system32\utilman.exe d:\windows\system32\utilman.exe.bak

Note: On Windows Server 2008 R2, we will most likely have to replace the drive letter d: with c: If you are unsure about the drive letter, search for the drive that contains the Windows folder. The driver letter for the instance of Windows PE that started Windows Setup is x:

copy d:\windows\system32\cmd.exe d:\windows\system32\utilman.exe


Copy cmd.exe

  • Remove the boot media from the server and tell Windows PE to reboot:
wpeutil reboot
  • Once your domain controller is running again, click the Utility Manager icon.
Utility Manager icon


  •     At the command prompt that (I hope) opened, reset the domain admin password with this command, Type your password and hit enter again retype the same. We’ll get successful message
net user administrator *


Reset domain admin password
  • Mainly for security reasons, I highly recommend restoring the original utilman.exe. For this, you have to again boot Windows Server set-up, follow steps 1-2, and then enter:
move /y d:\windows\system32\utilman.exe.bak d:\windows\system32\utilman.exe

(Replace the drive letter if Windows isn’t installed on the d:)
Restore utilman.exe

  •        After we removed the boot media , we can reboot the server again with

wpeutil reboot

Password reset complete