手机
当前位置:查字典教程网 >脚本专栏 >PowerShell >Powershell从注册表中查询默认MAPI客户端的例子
Powershell从注册表中查询默认MAPI客户端的例子
摘要:当你通过类似Mailto:链接发送邮件,此时邮件客户端就是MAPI客户端。如果要找出到这个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_ROOTmailtoshellopencommand'# 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客户端的例子1

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

【Powershell从注册表中查询默认MAPI客户端的例子】相关文章:

Powershell截取字符串并添加省略号的例子

PowerShell函数中把参数传入另一个函数的函数传参例子

Powershell创建简洁的HTML报告例子

Powershell小技巧之使用WMI查询插上的U盘

PowerShell实现在字符串中查找大写字母

Powershell 查找用户的主SMTP地址

使用PowerShell修改注册表

PowerShell脚本中查看网卡的高级属性

PowerShell函数中限制数组参数个数的例子

PowerShell多线程执行前后台作业的例子

精品推荐
分类导航