Powershell: How to re-provsion the sync DB to resolve the issue that User Profile Synchronization Service fails to start?

You can use the below script: ================================== Get-SPDatabase $syncdb=Get-SPDatabase -Id$syncdb.Unprovision()$syncdb.Status=’Offline’Get-SPServiceApplication$upa=Get-SPServiceApplication – Id$upa.ResetSynchronizationMachine()$upa.ResetSynchronizationDatabase()$syncdb.Provision()  

0

Powershell: How to restart the User Profile Synchronization Service if disabled?

Below script shows how to restart the User Profile Synchronization Service if disabled.   ============================================ # Loads the SharePoint 2010 PowerShell extensions Add-PSSnapIn Microsoft.SharePoint.PowerShell  # Sets variable for User Profile Service Application: enter the name of your UPA in quotes, replacing the “UPA” example$upa = Get-SPServiceApplication |?{$_.displayname -eq “UPA”}# Sets variable for service instance: enter…

3

How to query network adapter for IPv6 protocol?

Assuming you need it in script, PowerShell: # computername $MachineName = ‘localhost’   # open HKLM reg on $MachineName $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey(‘LocalMachine’, $MachineName)   # open subKey SYSTEMCurrentControlSetservicesTCPIP6Linkage $regKey = $reg.OpenSubKey(“SYSTEM\CurrentControlSet\services\TCPIP6\Linkage”)   # get the values from the name ‘Bind’ # e.g. Device{A2B312D5-A133-4779-B21B-5B3ED82B6DCF} $bind = $regKey.GetValue(“bind”)   # get adapters that are IP enabled :…

0

How to determine if current user is a domain or local user?

Assuming you need it in script, PowerShell:   (gwmiWin32_LogonSession).GetRelated(“Win32_UserAccount”)   If you expect more than one logon session, then   (gwmi Win32_Process -filter “Handle = $Pid”).GetRelated(“Win32_LogonSession”) |% {$_.GetRelated(“Win32_UserAccount”)}   will give you Win32_UserAccount for the account used to run current powershell instance.

3