Quick demo for how to customize the Central Admin GUI default Sync database name (prefilled with GUID) to custom value more readable and admin friendly.
Simply press F12, select the text field, and remove “disabled=disabled” from the <INPUT> HTML element. Now able to enter any value and click “Create” UPS.
Quick code snippet to share with you guys for rebooting the full SharePoint farm. Invoke remote restart command to all peer machines with any valid SharePoint role, then reboot local machine last. NOTE – SQL not included but can be with adjusting the filter. Cheers.
All scheduled PowerShell files should generate LOGs. “Start-Transcript” is a great cmdlet for this. Adding a few more features can boost operations support. LOGs answer essentials support questions like:
Which parent PS1 generated this LOG?
Did script perform needed functions?
Any errors?
How long did it take?
Which user and computer ran the script?
Below is code template I recommend to for scheduled PowerShell jobs to generate a LOG. Key features include:
Auto detect current folder and script PS1
Create \LOG\ subfolder
Prefix to match parent PS1
Suffix with unique date time stamp
Elapsed run duration (Days, Hours, Minutes)
Thank you to @ToddKlindt for improvements to formula and elapsed time. Cheers.
Video
Code
function Main() {
### YOUR CODE HERE
}
# Open Log
$prefix = $MyInvocation.MyCommand.Name
$host.UI.RawUI.WindowTitle = $prefix
$stamp = Get-Date -UFormat "%Y-%m-%d-%H-%M-%S"
Start-Transcript "$PSScriptRoot\log\$prefix-$stamp.log"
$start = Get-Date
Main
# Close Log
$end = Get-Date
$totaltime = $end - $start
Write-Host "`nTime Elapsed: $($totaltime.tostring("hh\:mm\:ss"))"
Stop-Transcript
When running PowerShell administration jobs for many hours within RDP session, we are open to risk of accidental pause. Other admins might RDP into server, click around, switch windows, and accidentally pause.
Disabling the default “Quick Edit” PowerShell window feature ensures protection for script to continue uninterrupted.