Mayo Nesso
Mayo Nesso

Reputation: 11

How to get the actual status of a value..(Powershell)

I found a lot of information on Internet about PowerShell and I started to learn it.But it's very hard! (my fantasi is not the best in the world..)

Now, I found this script and I can use it to change some values in the TargetApp. But, I want just to get the actual status of a value. Kan someone help me? For exemple, how can I get the actual status of the string "ApplicationAccessChecksEnabled"?

$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog
$apps = $comAdmin.GetCollection("Applications")
$apps.Populate();
$app = $apps | Where-Object {$_.Name -eq $targetApp}
$app.Value("Identity") = $identity
$app.Value("Password") = $passwordEncrypted
$app.Value("ApplicationDirectory") = $appRootDir
$app.Value("ConcurrentApps") = 1 # set to default
$app.Value("RecycleCallLimit") = 0 # set to default
$app.Value("Activation") = 1 # dedicate local server process
$app.Value("ApplicationAccessChecksEnabled") = 0
$apps.SaveChanges()

Upvotes: 1

Views: 276

Answers (1)

Joey
Joey

Reputation: 354714

Just use

$app.Value('ApplicationAccessChecksEnabled')

and don't assign a new value. That's a so-called parametrised property, so it has an argument (a string in this case) and you can get or set a value.

Upvotes: 2

Related Questions