Autor Thema: Benutzer und Kennwort bei WMI-Abfrage übergeben  (Gelesen 8454 mal)

Offline Lloyd

  • Aktives Mitglied
  • ***
  • Beiträge: 211
Benutzer und Kennwort bei WMI-Abfrage übergeben
« am: 04.08.08 - 18:07:46 »
Server 7.0.3
Clients 7.0.3
---------------
Hallo,
kann ich bei einer WMI-Abfrage via Notes Script Benutzernamen und Kennwort mitgeben. Ich möchte diverse Geräte abfragen, die zwar im Netzwerk hängen, nicht aber in der Domäne und wo ich nicht als lokaler User angelegt bin. Ich hatte mir vorgestellt, dass ich einen Dummy-User auf diesen Maschinen anlege wo sich das Kennwort nicht ändert und diesen in meinem Script übergebe. Habe ich auf diesen Geräte kein lokales Konto, kann ich auch keine WMI-Abfragen machen. Oder hat jemand eine andere Idee?

Ausschnitt meines bisherigen Scripts:
Set objReg = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv")
objReg.EnumKey HKLM, strKey, arrSubkeys
« Letzte Änderung: 04.08.08 - 18:23:56 von Lloyd »
Gruss
Lloyd

Offline Lloyd

  • Aktives Mitglied
  • ***
  • Beiträge: 211
Re: Benutzer und Kennwort bei WMI-Abfrage übergeben
« Antwort #1 am: 04.08.08 - 18:23:20 »
Hmm,
mir ist etwas rätselhaft, warum "koehlerbv" diesen Beitrag hierher verschoben hat. Ich hätte diesen Beitrag ja in der Rubrik für Notes Entwicklung gelassen.

Kann mir hier jemand weiterhelfen, oder kann der Moderator diesen Beitrag wieder in die Rubrik Notes 7 Entwicklung schieben?
Gruss
Lloyd

Offline koehlerbv

  • Moderatoren
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 20.460
  • Geschlecht: Männlich
Re: Benutzer und Kennwort bei WMI-Abfrage übergeben
« Antwort #2 am: 04.08.08 - 18:27:36 »
Was hat das mit Notes zu tun? Du nutzt WMI unter Notes, aber Dein Problem liegt doch eindeutig "auf der anderen Seite".

Bernhard

Offline Lloyd

  • Aktives Mitglied
  • ***
  • Beiträge: 211
Re: Benutzer und Kennwort bei WMI-Abfrage übergeben
« Antwort #3 am: 04.08.08 - 18:33:36 »
Hi Bernhard,
mein Problem liegt in Notes. Ich suche eine Möglichkeit in meinem Notes Script einen Benutzernamen und ein Kennwort für die WMI-Abfrage der Remotesysteme mitzugeben.

Gruß
Lloyd
Gruss
Lloyd

Offline m3

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 8.102
  • Geschlecht: Männlich
  • Non ex transverso sed deorsum!
    • leyrers online pamphlet
Re: Benutzer und Kennwort bei WMI-Abfrage übergeben
« Antwort #4 am: 04.08.08 - 19:58:07 »
Das ist IMHO kein Notes-Problem, sondern ein Windows/WMI Problem:

Zitat
The WMI moniker "winmgmts:" enables you use just one line of code to concisely describe a WMI object or collection of WMI objects to manage. However, with power comes the difficulty of constructing complex WMI moniker strings. The following sections of this chapter decipher the components you can use to construct WMI monikers and look at some best practices for writing WMI scripts that use WMI monikers.
...
The second, and typically optional, part of WMI monikers is the security settings component. The security settings component has been a source of confusion for many system administrators. This is primarily because of the impersonationLevel setting, which behaves differently depending on the version of WMI installed on a target computer.

The optional security settings component lets you specify several different security settings that are used to connect to and communicate with WMI.
http://www.microsoft.com/technet/scriptcenter/guide/sas_wmi_jgfx.mspx?mfr=true

Wobei zu beachten wäre:
Zitat
Granting privileges within a script does not confer those privileges upon the user. For example, suppose you try to run a script that includes the Shutdown privilege. If you do not already have the Shutdown privilege, the script will fail; as is always the case with WMI, you are not allowed to use a script to carry out a task that you would otherwise not be able to perform. To carry out a task that requires a privilege such as Shutdown or Backup, two things must be true:
•   The script must specify the privilege in the connection string.
•   You must already possess the privilege.
HTH
m³ aka. Martin -- leyrers online pamphlet | LEYON - All things Lotus (IBM Collaborations Solutions)

All programs evolve until they can send email.
Except Microsoft Exchange.
    - Memorable Quotes from Alt.Sysadmin.Recovery

"Lotus Notes ist wie ein Badezimmer, geht ohne Kacheln, aber nicht so gut." -- Peter Klett

"If there isn't at least a handful of solutions for any given problem, it isn't IBM"™ - @notessensai

Offline Lloyd

  • Aktives Mitglied
  • ***
  • Beiträge: 211
Re: Benutzer und Kennwort bei WMI-Abfrage übergeben
« Antwort #5 am: 05.08.08 - 10:33:00 »
Hi,
ok ich geb mich geschlagen. Es gehört hierher. Ich hab mir jetzt auf Grund deines Beitrags jede Menge Dinge im Google reingepfiffen und den ein oder anderen Hinweis bzgl. einer Authentification gefunden. Ich bekomme diese allerdings nicht richtig in mein Script reingebastelt. Ich muß ein Impersonation Level reinbringen, da ich auf Windows 2000 Systeme von einem Win2003 Umfeld zugreife und ich muß ein AutheticationLevel irgendwie reinbauen. Das alles muß, wenn ich es richtig verstanden habe in die Zeile

Set objReg = GetObject("winmgmts:" & "{impersonationLevel=Impersonate,"  & "authenticationLevel=Pkt}!\\" & strComputer & "/root/default:StdRegProv")

Ich hab schon einiges ausprobiert, aber es haut nicht hin. Kannst du mir unter die Arme greifen? Hier muß irgendwo noch der User und dass Passwort rein. Anbei noch mein komplettes Script, was die installierte Software vom Remotesystem ausliest.


Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Dim strKey As String
Dim intRet As Integer
Dim arrSubkeys As Variant
Dim ApplList As New ArraySets
   
Call ApplList.Init
   
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
   
If strComputer = "" Or Ucase(strComputer) = "LOCALHOST" Then
   strComputer = "."
End If
   
Set objReg = GetObject("winmgmts:" & "{impersonationLevel=Impersonate,"  & "authenticationLevel=Pkt}!\\" & strComputer & "/root/default:StdRegProv")
   
objReg.EnumKey HKLM, strKey, arrSubkeys
   
Forall S In arrSubkeys
      
   intRet = objReg.GetStringValue(HKLM, strKey & S, "DisplayName", strValue)
   If intRet <> 0 Then
      objReg.GetStringValue HKLM, strKey & S ,"QuietDisplayName", strValue      
   End If
   objReg.GetStringValue HKLM, strKey & S ,"DisplayVersion", strValue1
   objReg.GetStringValue HKLM, strKey & S ,"InstallDate", strValue2
   objReg.GetStringValue HKLM, strKey & S ,"InstallLocation", strValue3      
   objReg.GetStringValue HKLM, strKey & S ,"InstallSource", strValue4         
   objReg.GetStringValue HKLM, strKey & S ,"Publisher", strValue5      
   objReg.GetStringValue HKLM, strKey & S ,"Contact", strValue6      
   objReg.GetStringValue HKLM, strKey & S ,"HelpLink", strValue7
   objReg.GetStringValue HKLM, strKey & S ,"HelpTelephone", strValue8
   objReg.GetStringValue HKLM, strKey & S ,"URLInfoAbout", strValue9
   objReg.GetStringValue HKLM, strKey & S ,"URLUpdateInfo", strValue10      
   strValue = strValue + "~" + strValue1 + "~" + strValue2 + "~" + strValue3 + "~" + strValue4 + "~" + strValue5 + "~" + strValue6 + "~" + strValue7 + "~" + strValue8 + "~" + strValue9 + "~" + strValue10
      
   ApplList.AddElement ( strValue)      
End Forall
« Letzte Änderung: 05.08.08 - 10:58:23 von Lloyd »
Gruss
Lloyd

Offline rene_h

  • Frischling
  • *
  • Beiträge: 2
Re: Benutzer und Kennwort bei WMI-Abfrage übergeben
« Antwort #6 am: 23.10.08 - 14:24:46 »
Hallo, ...

Ich stehe momentan vor dem gleichen Problem.
Auslesen auf dem lokalen PC klappt wunderbar, ohne Probleme.
Problematisch wird es jedoch wenn ich "versuche" Benutzername und Passwort mit zu übergeben.

Ziel ist unserem Admin die Möglichkeit zu geben übers Netz Daten von entfernten Rechnern auszulesen.
Leider weiss ich nicht wie ich das ConnectionObject "simulieren" kann.
Jemand noch eine Idee?

grüße Rene

Offline rene_h

  • Frischling
  • *
  • Beiträge: 2
Re: Benutzer und Kennwort bei WMI-Abfrage übergeben
« Antwort #7 am: 24.10.08 - 10:18:25 »
keiner eine Idee ?

grüße Rene

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz