0

我有以下注册表项

$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

如何获取属性值并基于它执行操作?

4

1 回答 1

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 ..
}
于 2012-07-13T16:26:29.820 回答