cmdlets/Server-1C.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
function New-Server1C { [CmdletBinding()] param( [string]$ConectionString="" ) if ($ConectionString -eq ""){ New-Object Server1C } else { New-Object Server1C $ConectionString } }# end New-Server1C # описание класса class Server1C { # Свойства [String]$LogPath [String]$NameComObject = 'V83.COMConnector' [__COMObject]$Connector [__COMObject]$ConnectionAgent [__COMObject]$ConnectionWorkingProcess [bool]$AgentIsConnected [bool]$WorkingProcessIsConnected # Конструктор Server1C() { $this.Connector = New-Object -COMObject $this.NameComObject }# end Server1C() Server1C([String]$ConectionString) { $this.Connector = New-Object -COMObject $This.NameComObject $this.ConnectAgent($ConectionString) $this.ConnectWorkingProcess($ConectionString) }# end Server1C([String]$ConectionString) # Методы [bool]ConnectAgent([String]$ConectionString) { $this.ConnectionAgent = $this.Connector.ConnectAgent($ConectionString) return $this.ConnectionAgent -ne $null }# end ConnectAgent [bool]ConnectWorkingProcess([String]$ConectionString) { $this.ConnectionWorkingProcess = $this.Connector.ConnectWorkingProcess($ConectionString) return $this.ConnectionWorkingProcess -ne $null }# end ConnectWorkingProcess [bool]KillConnectionBase([String]$NamesBases, [String]$NamesUsers) { if ($this.ConnectionWorkingProcess -eq $null) { Write-Error "Не установлено соединение с рабочим процессом сервера" return $false } # $InfoBases = $this.ConnectionWorkingProcess.GetInfoBases # foreach($InfoBase in $InfoBases){ # if ($InfoBase -in $NamesBases){ # } # } return $true }# end KillConnectionBase }# end class Server1C |