我有以下注册表项
$rKey="hklm:\SOFTWARE\Wow6432Node\Mycompany\MyProj\Core"
此键将具有以下参数
DBServer="Installed"
AppServer="Installed"
WebServer="Installed"
我想查看
if DBserver="Installed" Then do some action
Else Do nothing
If Appserver="Installe" then do some action
Else Do nothing
If Webserver ="Installed" then do some action
Else Do nothing
如何获取属性值并根据它执行操作?
答案 0 :(得分:1)
$p = Get-ItemProperty $key
if($p.DBserver -eq "Installed")
{
.. do some action ..
}
if($p.Appserver-eq "Installed")
{
.. do some action ..
}
if($p.Webserver -eq "Installed")
{
.. do some action ..
}