135 lines
3.4 KiB
PowerShell
135 lines
3.4 KiB
PowerShell
Function Set-windreamIndex-withLogging {
|
|
|
|
<#
|
|
.SYNOPSIS
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
|
|
.REQUIREMENT General
|
|
PowerShell V3
|
|
|
|
.REQUIREMENT Assembly
|
|
|
|
|
|
.REQUIREMENT Variables
|
|
|
|
|
|
.REQUIREMENT Variables preSet
|
|
|
|
|
|
.REQUIREMENT Functions
|
|
Write-LogFile, Start-windreamSession-withLogging
|
|
|
|
.VERSION
|
|
1.0.0.0 / 20.01.2017
|
|
|
|
.PARAMETER ModuleName
|
|
|
|
|
|
.PARAMETER ModuleOverrideSourcePath
|
|
|
|
|
|
.EXAMPLE
|
|
|
|
|
|
.EXAMPLE
|
|
|
|
|
|
|
|
#>
|
|
|
|
[cmdletbinding()]
|
|
|
|
Param (
|
|
|
|
[Parameter(Position=0,Mandatory=$True,ValueFromPipeline=$True,HelpMessage='Give the ModuleName, you want to load into the current PSSession (without File-Extension)')]
|
|
[ValidateNotNullOrEmpty()]
|
|
[Object]$windreamSession,
|
|
|
|
[Parameter(Position=1,Mandatory=$True,ValueFromPipeline=$True,HelpMessage='Give the ModuleName, you want to load into the current PSSession (without File-Extension)')]
|
|
[ValidateNotNullOrEmpty()]
|
|
[String]$windreamFile,
|
|
|
|
[Parameter(Position=2,Mandatory=$True,ValueFromPipeline=$True,HelpMessage='Give the ModuleName, you want to load into the current PSSession (without File-Extension)')]
|
|
[ValidateNotNullOrEmpty()]
|
|
[String]$windreamIndex,
|
|
|
|
[Parameter(Position=3,Mandatory=$True,ValueFromPipeline=$True,HelpMessage='WMEntityDocumentAndMap = 0, WMEntityDocument = 1, WMEntityFolder = 2')]
|
|
[ValidateSet(0,1,2)]
|
|
[Int]$windreamIndexEntity,
|
|
|
|
[Parameter(Position=4,Mandatory=$True,ValueFromPipeline=$True,HelpMessage='Give the ModuleName, you want to load into the current PSSession (without File-Extension)')]
|
|
[ValidateNotNullOrEmpty()]
|
|
[Array]$windreamIndexValue
|
|
|
|
) #end param
|
|
|
|
#Clear Error Variable
|
|
$error.clear()
|
|
|
|
#Checking if "Write-LogFile" Module was loaded
|
|
IF (Get-Module -Name "Write-LogFile") {
|
|
|
|
Write-Host "DEBUG Info: Write-LogFile - Module exists."
|
|
|
|
IF (Get-Module -Name "Start-windreamSession-withLogging") {
|
|
|
|
Write-Host "DEBUG Info: Start-windreamSession-withLogging - Module exists."
|
|
|
|
|
|
#[String]$File1 = "\Projekt01 - Geschäftsprozesse\Abnahmeprotokoll\Ap-126506.pdf"
|
|
|
|
$windreamFSObject = $windreamSession.GetWMObjectByPath($WMEntityDocument, [String]$File1)
|
|
|
|
IF ($windreamFSObject.aLocked -eq $True) {
|
|
|
|
Write-Logfile -LogLine "File is locked."
|
|
|
|
} #end if
|
|
|
|
ELSEIF ($windreamFSObject.aLocked -eq $false) {
|
|
|
|
Write-Logfile -LogLine "File is unlocked."
|
|
$windreamFSObject.lock()
|
|
$windreamFSObject.SetVariableValue("String 09","Herbert5")
|
|
$windreamFSObject.save()
|
|
$windreamFSObject.unlock()
|
|
$windreamFSObject.aID
|
|
|
|
} #end elseif
|
|
|
|
ELSE {
|
|
|
|
Write-Logfile -LogLine ""
|
|
Write-Logfile -LogLine "Unexpected Error!"
|
|
|
|
} #end else
|
|
|
|
} #end if
|
|
|
|
ELSE {
|
|
|
|
Write-Host ""
|
|
Write-Host "DEBUG Info: Start-windreamSession-withLogging - Module does not exist!"
|
|
Write-Host "DEBUG Info: Please load the Module and try again, running this Function/Module!"
|
|
Write-Host "DEBUG Info: Exiting, because of this Issue."
|
|
EXIT
|
|
|
|
} #end else
|
|
|
|
} #end if
|
|
|
|
ELSE {
|
|
|
|
Write-Host ""
|
|
Write-Host "DEBUG Info: Write-LogFile - Module does not exist!"
|
|
Write-Host "DEBUG Info: Please load the Module and try again, running this Function/Module!"
|
|
Write-Host "DEBUG Info: Exiting, because of this Issue."
|
|
EXIT
|
|
|
|
} #end else
|
|
|
|
|
|
} #end function |