cancel
Showing results for 
Search instead for 
Did you mean: 

Support for PowerShell

Scott_Hardwick
Champ on-the-rise
Champ on-the-rise

Have any plans or roadmaps been announced to potentially support PowerShell in addition to (or as a replacement for) VBScript?

While I am fluent in PowerShell, I haven't used VBScript in probably 15 years.

Thanks for any information you may be able to provide.

2 ACCEPTED ANSWERS

AdamShaneHyland
Employee
Employee

Hi @Scott Hardwick ,

 

You can find more information required for creating a Client Pre-processor in the OnBase Automation and Client API documentation in the OnBase Client SDK ...

 

https://community.hyland.com/gallery/items/50539-onbase-client-sdk-all-versions

 

The documentation references using C#, but I imagine it wouldn't be hard to abstract that to PowerShell.  

 

@Jim Perry , but chance, do you have a high level example to share?

 

Best wishes.

View answer in original post

Eric_Maerz
Confirmed Champ
Confirmed Champ

Here is a quick example on how to get started with Unity API in Powershell. The Unity API Documentation can be found here https://sdk.onbase.com/

 

Import-Module -Name "C:\Program Files (x86)\Hyland\Hyland.Interop\Hyland.Types.dll"Import-Module -Name "C:\Program Files (x86)\Hyland\Hyland.Interop\Hyland.Unity.dll"$URL = "https://onbaseServer/AppServer64/service.asmx"$DataSource = "OnBaseDB_datasource"$Username = "user"$Password = "password"#Standard Login Proceodrue$oAppProps = [Hyland.Unity.Application]::CreateOnBaseAuthenticationProperties($URL, $Username, $Password, $DataSource);$oApp =  [Hyland.Unity.Application]::Connect($oAppProps)#NT Login Procedure#$oApp =  [Hyland.Unity.Application]::ConnectUsingDomainAuthentication($URL, $DataSource)#Get the logged in user's name$OnBaseUsername = $oApp.CurrentUser.RealNameWrite-Host "The current OnBase user is $name" #Get some document properties$Document = $oApp.Core.GetDocumentByID(1234)Write-Host "The document was created by: " + $Document.CreatedBy.DisplayName#Disconnect from OnBase$oApp.Disconnect()

View answer in original post

8 REPLIES 8

AdamShaneHyland
Employee
Employee

Hi @Scott Hardwick ,

 

You can find more information required for creating a Client Pre-processor in the OnBase Automation and Client API documentation in the OnBase Client SDK ...

 

https://community.hyland.com/gallery/items/50539-onbase-client-sdk-all-versions

 

The documentation references using C#, but I imagine it wouldn't be hard to abstract that to PowerShell.  

 

@Jim Perry , but chance, do you have a high level example to share?

 

Best wishes.

A really simple example that we use removes several lines from the beginning of the file.

Preprocessor Location: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Preprocessor Parameters: -ExecutionPolicy Bypass -File "[path_to]\Preprocessors\PS_Remove4_PreProcessor.ps1" %I %O 4

Successful Return Value: 2

 

$source = $args[0]
$target = $args[1]
$lines = $args[2]
[int]$code = 0
If (Test-Path -LiteralPath $source -PathType Leaf) {
$script:code++
If ((Get-Content $source | Select-Object -Skip $lines) | Set-Content $target -PassThru -ErrorAction silentlyContinue) {
$script:code++
}
}
exit $code

No one person needs to know everything—they simply need to know who knows it.

Thank you @Jim Perry !  Hopefully others will find this useful.

Eric_Maerz
Confirmed Champ
Confirmed Champ

Here is a quick example on how to get started with Unity API in Powershell. The Unity API Documentation can be found here https://sdk.onbase.com/

 

Import-Module -Name "C:\Program Files (x86)\Hyland\Hyland.Interop\Hyland.Types.dll"Import-Module -Name "C:\Program Files (x86)\Hyland\Hyland.Interop\Hyland.Unity.dll"$URL = "https://onbaseServer/AppServer64/service.asmx"$DataSource = "OnBaseDB_datasource"$Username = "user"$Password = "password"#Standard Login Proceodrue$oAppProps = [Hyland.Unity.Application]::CreateOnBaseAuthenticationProperties($URL, $Username, $Password, $DataSource);$oApp =  [Hyland.Unity.Application]::Connect($oAppProps)#NT Login Procedure#$oApp =  [Hyland.Unity.Application]::ConnectUsingDomainAuthentication($URL, $DataSource)#Get the logged in user's name$OnBaseUsername = $oApp.CurrentUser.RealNameWrite-Host "The current OnBase user is $name" #Get some document properties$Document = $oApp.Core.GetDocumentByID(1234)Write-Host "The document was created by: " + $Document.CreatedBy.DisplayName#Disconnect from OnBase$oApp.Disconnect()