华域联盟 PowerShell Powershell从注册表中查询默认MAPI客户端的例子

Powershell从注册表中查询默认MAPI客户端的例子

当你通过类似Mailto:链接发送邮件,此时邮件客户端就是MAPI客户端。如果要找出到这个MAPI客户端在哪里,这里有个函数能从注册表中获得该信息。

复制代码 代码如下:

functionGet-MAPIClient

{

    functionRemove-Argument

    {

      param

      (

        $CommandLine

      )

      $divider=''if ($CommandLine.StartsWith('"'))

      {

        $divider='"'$CommandLine=$CommandLine.SubString(1)

      }

      $CommandLine.Split($divider)[0]
    }

  $path='Registry::HKEY_CLASSES_ROOT\mailto\shell\open\command'# create new object to return values

$returnValue=1|Select-Object-PropertyHasMapiClient,Path,MailTo$returnValue.hasMAPIClient=Test-Path-Path$pathif ($returnValue.hasMAPIClient)

  {

    $values=Get-ItemProperty-Path$path$returnValue.MailTo=$values.'(default)'$returnValue.Path=Remove-Argument$returnValue.MailToif ((Test-Path-Path$returnValue.Path) -eq$false)

    {

      $returnValue.hasMAPIClient=$true

    }

  }

   

  $returnValue

}

Get-MAPIClient

执行后的结果类似:

举一反三,同样也可以修改代码查询其它类型的默认客户端。

您可能感兴趣的文章:

本文由 华域联盟 原创撰写:华域联盟 » Powershell从注册表中查询默认MAPI客户端的例子

转载请保留出处和原文链接:https://www.cnhackhy.com/14114.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部