BIZTalk210 powerscript停止和启动发送端口 [英] BIZTalk210 powerscript to stop and start SEND PORT

查看:89
本文介绍了BIZTalk210 powerscript停止和启动发送端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

BIZTalk2010 powerscript停止和启动发送端口"

我的接收位置工作正常. BizTalk2010重新启动每小时接收一次位置

I got the receive location working ok. BizTalk2010 restart Receive location every hour

现在,我需要对发送端口执行相同的操作.但这是行不通的.

Now I need to do the same with the send ports. But it does not work.

# a. Set Server name in ConnectionString -- 
# b. Set ($hostname) host name value that is using in SFTP send location
# c. Set ($sndLocation) send location name

$Catalog.ConnectionString ="xxx"
$hostname = "bbb"
$sndLocation = "SndPrt_XXXXXXX001" #send location

# Function to retrieve the status of the specify send port
function getStatus() {
    foreach ($sendPort in $catalog.SendPorts) {
        foreach($sendLoc in $sendPort.SendPorts 
                | Where {$_.Name -eq $sndLocation}) {
            return $sendLoc.enabled
        }
    }
}

# Function to enable the send port
function enablesendLocation() {
    $location = get-wmiobject MSBTS_SendPort -Namespace 
            'root\MicrosoftBizTalkServer' -Filter "name='${sndLocation}'"
    [void]$location.Start()
    [void]$Catalog.Refresh()
}

# Function to disable the send port
function disablesendLocation() {
    $location = get-wmiobject MSBTS_sendport -Namespace 
            'root\MicrosoftBizTalkServer' -Filter "name='${sndLocation}'"
    [void]$location.Stop()
    [void]$Catalog.Refresh()
}

{
    # Enable send location
    enablesendLocation
}

推荐答案

解决方案是

function getStatus(){

    foreach ($sendPort in $Catalog.SendPorts | Where {$_.Name -eq $sndLocation })
    {    
        return $sendPort.Status           
    } }

function enablesendLocation(){

    foreach ($sendPort in $Catalog.SendPorts | Where {$_.Name -eq $sndLocation })
    {    
        $sendPort.Status = 3
        $Catalog.SaveChanges()    
        $Catalog.Refresh()
    } }

function disablesendLocation(){

    foreach ($sendPort in $Catalog.SendPorts | Where {$_.Name -eq $sndLocation })
    {    
        $sendPort.Status = 2
        $Catalog.SaveChanges()    
        $Catalog.Refresh()
    } }

这篇关于BIZTalk210 powerscript停止和启动发送端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆