How to know Last Boot uptime of servers
Hi All,
Below is the sample script for that. Run this in your local desktop.
$computers = "Server1",”Server2”
$os = Get-CimInstance Win32_operatingSystem -ComputerName $computers
$os | Select Caption,OSArchitecture,InstallDate,LastBootUpTime,@{Name="Uptime";Expression={(Get-Date)-$_.LastBootUpTime}},PSComputername
Regards,
Chaitanya
how to Know FQDN of Server
Hi All,
Below is the sample script for that. Run this in your local desktop.
$server=hostname
[String]$ServerName=[System.Net.Dns]::GetHostEntry([string]$Server).HostName
$ServerName
If you want to know about remote servers, use the invoke-command command let.
Regards,
Chaitanya
Deleting BizTalk Party using PowerShell
Hi All,
Below is the sample script for that.
$BizTalkGroupMgmtDbServerFullName = get-wmiobject MSBTS_GroupSetting -namespace root\MicrosoftBizTalkServer | select-object -expand MgmtDbServerName
$BizTalkGroupMgmtDbName = get-wmiobject MSBTS_GroupSetting -namespace root\MicrosoftBizTalkServer | select-object -expand MgmtDbName
if($BizTalkGroupMgmtDbServerFullName)
{
$BizTalkGroupMgmtDbServerFullNameArr = $BizTalkGroupMgmtDbServerFullName.Split(",")
$BizTalkGroupMgmtDbServerName = $BizTalkGroupMgmtDbServerFullNameArr[0]
}
[void] [System.reflection.Assembly]::LoadWithPartialName("Microsoft.BizTalk.ExplorerOM")
$Catalog = New-Object -TypeName Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer
$Catalog.ConnectionString = "SERVER=$BizTalkGroupMgmtDbServerName;DATABASE=$BizTalkGroupMgmtDbName;Integrated Security=SSPI"
$party = "PartyName"
Write-Host "Started Removing Party : ‘$Party’"
$partyinfo = $Catalog.parties[$Party]
$Catalog.RemoveParty($partyinfo);
$Catalog.SaveChanges();
You might receive this error in this process.
Exception calling "SaveChanges" with "0" argument(s): "The transaction associated with the current connection has completed but has not been disposed. The transaction must be disposed before the connection can
be used to execute SQL statements."
Please check the MSDTC timeout setting. It should be more than a minute.
Regards,
Chaitanya
Test Website Availability using PowerShell
Hi All,
Below is the sample script for that.
$uri = ‘https://www.sqlblogging.com/‘
$data = Invoke-webrequest $uri
$data|select statuscode
StatusCode
Run PowerShell Commands Asynchronously.
Below is the script link for calling PowerShell commands asynchronously without using jobs.
https://gallery.technet.microsoft.com/scriptcenter/Invoke-Async-Allows-you-to-83b0c9f0
Regards,
Chaitanya
How to Get IIS logging Directory/Path using Poweshell
To get the IIS web sites log paths .below is sample PowerShell snippet.
Import-Module WebAdministration
$webistes=get-website
foreach($WebSite in $webistes)
{
$logFile="$($Website.logFile.directory)\w3scv$($website.id)".replace("%SystemDrive%",$env:SystemDrive)
Write-host "$($WebSite.name) [$logfile]"
}
Crediting this snippet to stack over flow site for this.
Regards,
Chaitanya
BizTalk 2016 Roadmap
Hi All,
You can Check this link https://www.microsoft.com/en-us/download/details.aspx?id=50408 which was released in December,it has discription of roadmap for BizTalk Server 2016, SQL Server 2016, Windows Server 2016 and Azure Integration.
Here is Microsoft word:
This roadmap explains our holistic approach to integration and the key product offerings that contribute to our integration capabilities. It details our vision and ambition as well as our strategy to address the challenges and opportunities for integration we see in the years ahead.
Regards,
Chaitanya
PowerShell Remoting Kerberos Double Hop Solved Securely
This is the issue has been troubling us over years. Eventually we have a secure solution. Please give it a try in test servers first.
Regards,
Chaitanya
Finding Time zone of server
If anyone want to know time zone of server, simply use the below command in PowerShell console.
tzutil /g
if you want to check it on remote servers, use invoke-command
invoke-command -scriptblock {tzutil /g} -ComputerName comp1,comp2
Regards,
Chaitanya
Windows Tip: How to record the steps in your activity
Sometimes we will be in a situation to record the activity that were doing.
Ex: if you are doing BizTalk cluster installation and you want to track each step you are doing, windows provides hidden gem.
Simply Go to run (WINDOWS KEY + R) and type “PSR” and hit enter.
Click on start recording and start your activity. It’s simple yet very useful.
You can save the entire session.
Regards,
Chaitanya