Hallo Community,
ich verzweifel an Powershell...
Folgendes habe ich geschrieben:
1  | $computerarray = @("Computer1")
 | 
2  | 
  | 
3  | foreach($computer in $computerarray)
  | 
4  | {
 | 
5  | 
  | 
6  |         $response = ActivateTPMChip("Passwort1")($computer)
 | 
7  | 
  | 
8  |          if($response -match "Success")
  | 
9  |         {
 | 
10  |             Write-Host "$computer BiosSettings wurden angepasst"
  | 
11  |         }
  | 
12  |         else
  | 
13  |         {
 | 
14  |             Write-Host "$computer BiosSettings wurde nicht angepasst... versuche 2 Passwort"
  | 
15  |             $2response = ActivateTPMChip("Passwort2")($computer)
 | 
16  |             if($2response -match "Success")
  | 
17  |             {
 | 
18  |                 Write-Host "$computer BiosSettings wurden angepasst"
  | 
19  |             }
  | 
20  |             else
  | 
21  |             {
 | 
22  |                 Write-Host "$computer scheint offline zu sein oder das BIOS password ist falsch"
  | 
23  |             }
  | 
24  |         }
  | 
25  | }
  | 
26  | 
  | 
27  | function ActivateTPMChip()
  | 
28  | {
 | 
29  |     $BiosPassword = $args[0]
  | 
30  |     $HostName = $args[1]
  | 
31  | 
  | 
32  |     $dummy99 = (gwmi -class Lenovo_SetBiosSetting -namespace root\wmi -ComputerName $HostName.ToString()).SetBiosSetting("TCG Security Feature,Active")
 | 
33  |     $dummy = (gwmi -class Lenovo_SaveBiosSettings -namespace root\wmi -ComputerName $HostName.ToString() -Authentication PacketPrivacy -Impersonation Impersonate).SaveBiosSettings("$BiosPassword.ToString(),ascii,us;")
 | 
34  |     return $dummy
  | 
35  | }
  | 
Dieses Script aktiviert den TPM Chip eines LenovoRechners anhand von 2 
Passwörtern...
Leider bekomme ich die Meldung nicht wie gewünscht zurück...
in der Varialbe "dummy" ist immer das 
System.Management.ManagementBaseObject enthalten.
Wenn ich der Zeile (gwmi -class Lenovo_SaveBiosSettings -namespace 
root\wmi -ComputerName $HostName.ToString() -Authentication 
PacketPrivacy -Impersonation 
Impersonate).SaveBiosSettings("$BiosPassword.ToString(),ascii,us;")
keiner Variable zuordne bekomme ich folgendes Ergebnis:
__GENUS          : 2
__CLASS          : __PARAMETERS
__SUPERCLASS     :
__DYNASTY        : __PARAMETERS
__RELPATH        :
__PROPERTY_COUNT : 1
__DERIVATION     : {}
__SERVER         :
__NAMESPACE      :
__PATH           :
return           : Success
PSComputerName   :
Und hier bin ich auf das Success scharf... wie komme ich an das Success 
/ die Fehlermeldung?
Grüße und vielen Dank!