当前位置: 首页 > 新闻动态 > 软件编程

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

作者:用户投稿 浏览: 发布日期:2026-01-16
[导读]:这篇文章主要介绍了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

执行后的结果类似:



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

免责声明:转载请注明出处:http://m.lexweb.cn/news/315123.html

扫一扫高效沟通

多一份参考总有益处

免费领取网站策划SEO优化策划方案

请填写下方表单,我们会尽快与您联系
感谢您的咨询,我们会尽快给您回复!