[gelöst] PowerShell-Version abfragen: "Zugriff verweigert"
Verfasst: 05 Aug 2015, 14:15
Hallo,
ich möchte in einem opsi-Winst-Skript abfragen, ob PowerShell 4.0 installiert ist: führt zu folgendem Output:
Mit reg.exe (als gleicher Benutzer ausgeführt) kann ich den Wert aber auslesen:
Kann sich jemand erklären, was ich falsch mache?
Vielen Dank
Holger
ich möchte in einem opsi-Winst-Skript abfragen, ob PowerShell 4.0 installiert ist:
Code: Alles auswählen
[Actions]
comment getRegistryStringValueSysNative("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3]")
comment getRegistryStringValueSysNative("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine]")
comment getRegistryStringValueSysNative("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine] PowerShellVersion")
Code: Alles auswählen
[1] [Aug 05 14:08:29:399] --
[1] [Aug 05 14:08:29:400] --
[1] [Aug 05 14:08:29:402] c:\opsi.org\log\opsi-script-part-Gu87Mn79.log
[1] [Aug 05 14:08:29:403] opsi-winst 4.11.4.21 started at 05.08.2015 13:21:40
[1] [Aug 05 14:08:29:404]
[1] [Aug 05 14:08:29:405] ============ Version 4.11.4.21 script "C:\Users\[...]\Desktop\test.ins"
[1] [Aug 05 14:08:29:406] used script encoding: cp1252
[1] [Aug 05 14:08:29:407] used system encoding: cp1252
[1] [Aug 05 14:08:29:408] start: 2015-08-05 14:08:29
[1] [Aug 05 14:08:29:408] on client named "[...]"
[1] [Aug 05 14:08:29:409] loggedin user ""
[1] [Aug 05 14:08:29:411] winst running as "[...]"
[1] [Aug 05 14:08:29:411] winst running with admin privileges
[1] [Aug 05 14:08:29:411] winst running in standard script mode
[1] [Aug 05 14:08:29:412] executing: "C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
[1] [Aug 05 14:08:29:414] system infos:
[1] [Aug 05 14:08:29:415] [...] - PC hardware address
[1] [Aug 05 14:08:29:417] [...] - IP name
[1] [Aug 05 14:08:29:418] [...] - IP address
[1] [Aug 05 14:08:29:421] DEU - System default locale
[1] [Aug 05 14:08:29:423] MS Windows 6.1 64 Bit
[1] [Aug 05 14:08:29:424]
[6] [Aug 05 14:08:29:427] Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion] opened
[6] [Aug 05 14:08:29:428] Key closed
[6] [Aug 05 14:08:29:483] Registry key [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3] opened
[6] [Aug 05 14:08:29:484] Key closed
[5] [Aug 05 14:08:29:486] comment:
[6] [Aug 05 14:08:29:489] Info: Registry key [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine] could not be opened by RegOpenKeyEx, Errorno 5 "Zugriff verweigert<"
[5] [Aug 05 14:08:29:490] comment:
[6] [Aug 05 14:08:29:493] Info: Registry key [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine] could not be opened by RegOpenKeyEx, Errorno 5 "Zugriff verweigert<"
[5] [Aug 05 14:08:29:495] comment:
[1] [Aug 05 14:08:29:503] ___________________
[1] [Aug 05 14:08:29:504] script finished
[1] [Aug 05 14:08:29:506] 0 errors
[1] [Aug 05 14:08:29:508] 0 warnings
[1] [Aug 05 14:08:29:509]
[1] [Aug 05 14:08:29:511]
Code: Alles auswählen
C:\>reg.exe query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine /v PowerShellVersion
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine
PowerShellVersion REG_SZ 4.0
Vielen Dank
Holger