Wednesday, March 23, 2016

Why Normally HNSC is using the port 80 with blank host header setting for web application ?

Copy from : http://www.jeremytaylor.net/2013/03/04/host-named-site-collections-sharepoint-2013/

Note – HNSC can be created on a non default Web Application but you’ll need to add bindings in IIS for your HNSC as the Web Application isn’t listening to all port 80 requests and would need to know about the HNSC it hosts. 

Thats why a lot of blogs usually specify HNSCs on default web apps, because adding IIS bindings can get messy. 

=======================================================================

If you using the port 80 with empty host header then you are no need do manually do IIS binding for your site collection HNSC . else you need to do IIS binding for each site collection created by HNSC.

Tuesday, March 22, 2016

Why cannot user SharePoint Farm Account for application pool ?

As i understand if application pool account using the SharePoint Farm Account  is over privilege but today i just notice we can extract the service account password from the application pool .

with the following script then we can get the password then just understand using the SharePoint Farm Service Account for application is very risky for the security leaking.

 PowerShell

try{
Import-Module WebAdministration
Get-WebApplication

$webapps = Get-WebApplication
$list = @()
foreach ($webapp in get-childitem IIS:\AppPools\)
{
$name = "IIS:\AppPools\" + $webapp.name
$item = @{}

$item.WebAppName = $webapp.name
$item.Version = (Get-ItemProperty $name managedRuntimeVersion).Value
$item.State = (Get-WebAppPoolState -Name $webapp.name).Value
$item.UserIdentityType = $webapp.processModel.identityType
$item.Username = $webapp.processModel.userName
$item.Password = $webapp.processModel.password

$obj = New-Object PSObject -Property $item
$list += $obj
}

$list | Format-Table -a -Property "WebAppName", "Version", "State", "UserIdentityType", "Username", "Password"

}catch
{
$ExceptionMessage = "Error in Line: " + $_.Exception.Line + ". " + $_.Exception.GetType().FullName + ": " + $_.Exception.Message + " Stacktrace: " + $_.Exception.StackTrace
$ExceptionMessage
}

copy from this site

Friday, March 18, 2016

Query to check which backup task is running at back end

SELECT r.session_id,command,
            s.text,
            start_time,
            percent_complete,
            CAST(((DATEDIFF(s,start_time,GetDate()))/3600) as varchar) + ' hour(s), '
                  + CAST((DATEDIFF(s,start_time,GetDate())%3600)/60 as varchar) + 'min, '
                  + CAST((DATEDIFF(s,start_time,GetDate())%60) as varchar) + ' sec' as running_time,
            CAST((estimated_completion_time/3600000) as varchar) + ' hour(s), '
                  + CAST((estimated_completion_time %3600000)/60000 as varchar) + 'min, '
                  + CAST((estimated_completion_time %60000)/1000 as varchar) + ' sec' as est_time_to_go,
            dateadd(second,estimated_completion_time/1000, getdate()) as est_completion_time
FROM sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) s
WHERE r.command in ('RESTORE DATABASE', 'BACKUP DATABASE', 'RESTORE LOG', 'BACKUP LOG')

Kill the process
Kill

KILL 1866 WITH STATUSONLY >> check the status on this progress