mirror of
https://github.com/helpsystems/EFTScriptSamples.git
synced 2025-01-18 01:21:55 -06:00
Merge pull request #4 from helpsystems/add-refreshuserdatabase
added refresh user database ps1 script
This commit is contained in:
commit
4c6ef4313c
61
powershell/RefreshUserDatabase.ps1
Normal file
61
powershell/RefreshUserDatabase.ps1
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Use EFT's COM interface to refresh the User Database for a specific site.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Use EFT's COM interface to programatically refresh the User Database for a site
|
||||||
|
|
||||||
|
.PARAMETER serverName
|
||||||
|
|
||||||
|
.PARAMETER eftAdminPort
|
||||||
|
|
||||||
|
.PARAMETER authMethod
|
||||||
|
|
||||||
|
.PARAMETER eftAdminName
|
||||||
|
|
||||||
|
.PARAMETER eftAdminPassword
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# Site Index First = 0, Second = 1 etc.
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory=$False)][string]$serverName = "localhost",
|
||||||
|
[Parameter(Mandatory=$False)][int]$eftAdminPort = 1100,
|
||||||
|
[Parameter(Mandatory=$False)][int]$authMethod = 1,
|
||||||
|
[Parameter(Mandatory=$False)][int]$siteIndex = 1,
|
||||||
|
[Parameter(Mandatory=$False)][string]$eftAdminName = "",
|
||||||
|
[Parameter(Mandatory=$False)][string]$eftAdminPassword = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# login as admin
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
try {
|
||||||
|
$oServer = New-Object -ComObject 'SFTPComInterface.CIServer'
|
||||||
|
$oServer.ConnectEx( $serverName, $eftAdminPort, $authMethod, $eftAdminName, $eftAdminPassword );
|
||||||
|
Write-Host "connected"
|
||||||
|
$oSite = $oServer.Sites().Item($siteIndex)
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$errorMessage = $_.Exception.Message;
|
||||||
|
Write-Host "failed to connect to server ${serverName}: ${errorMessage}"
|
||||||
|
Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# Sync the database
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
$oSite.ForceSynchronizeUserDatabase()
|
||||||
|
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# close resources
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
$oServer.Close()
|
||||||
|
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($oServer) | out-null
|
||||||
|
Remove-Variable oServer
|
Loading…
x
Reference in New Issue
Block a user