change the "Server Name" in the script. To stop change Provision() to UnProvision()
one thing to note is that if the status is provisioning, then you'll most likely need to Provision() then UnProvision().
Also all you need to do is get the service instance for other services by the type or name.
Also all you need to do is get the service instance for other services by the type or name.
--------------------------------------------------------------
add-pssnapin MIcrosoft.SharePoint.Powershell
Function MatchComputerName($computersList, $computerName)
{
If ($computersList -like "*$computerName*") { Return $true; }
foreach ($v in $computersList) {
If
($v.Contains("*") -or $v.Contains("#")) {
# wildcard processing
foreach ($item in -split $v) {
$item = $item -replace "#", "[\d]"
$item = $item -replace "\*", "[\S]*"
if ($computerName -match $item) {return $true;}
}
}
}
}
$secureStoreServiceInstances = Get-SPServiceInstance | ?
{$_.GetType().Equals([Microsoft.Office.SecureStoreService.Server.SecureStoreServiceInstance])}
$secureStoreServiceInstance = $secureStoreServiceInstances | ?
{MatchComputerName $_.Server.Address "Server Name"}
Write-HOst
$secureStoreServiceInstance.Status
$secureStoreServiceInstance.Provision()
For project service the type name is Microsoft.Office.Project.Server.Administration.PsiServiceInstance
ReplyDeleteor get the GUID using Get-SPServiceInstance -Server "servername"
$secureStoreServiceInstances = Get-SPServiceInstance -Identity "GUID"
Write-Host $secureStoreServiceInstances.GetType()
Write-HOst $secureStoreServiceInstances.Status
$secureStoreServiceInstances.UnProvision()
Using in 2020.. Keep this one forever.. Thanks a lot :)
ReplyDelete