Hallo. Ich möchte gerne eine Software mit AutoIt installieren. Ich kann das Programm leider nicht als Admin starten.. bzw. er startet es, will aber vorher nochmal ein Benutzer & Passwort von mir haben
Kann mir jemand helfen?
MFG Huetenden
Hallo. Ich möchte gerne eine Software mit AutoIt installieren. Ich kann das Programm leider nicht als Admin starten.. bzw. er startet es, will aber vorher nochmal ein Benutzer & Passwort von mir haben
Kann mir jemand helfen?
MFG Huetenden
Falls Du aus AutoIt heraus eine Software starten/installieren möchtest die Adminrechte verlangt, dann muss das Skript selbst auch mit den entsprechenden Rechten gestartet werden.
Folgende Anweisung an den Anfang des Scriptes setzen (hinter mögliche #include) :
#RequireAdmin
Innerhalb des Skriptes kannst Du mit der Funktion IsAdmin() prüfen, ob der aktuelle User über Adminrechte verfügt.
Ansonsten schaue Dir auch mal die Hilfe zu den Funktionen RunAs() bzw. RunAsWait() an.
Edit : Ich habe gerade mal deine Grafik vollständig geöffnet, da hast Du dies ja bereits getan.
Poste doch bitte dein komplettes Skript !
Gruß Musashi
Hi Musashi, danke das du dir Zeit nimmst!
pasted-from-clipboard.png
PS: Bitte auf das Bild klicken, iwie wird es nicht richtig angezeigt!
Ich bin mir ziemlich sicher, dass deine Anmeldedaten innerhalb der Domain nicht Benutzer:Passwort@Domain lauten.
Normalerweise sollte #RequireAdmin mit einem Run oder ShellExecute automatisch den Kindprozess mit erhöhten Rechten starten.
Die Passworteingabe wäre nur beim AutoIt-Script fällig, aber nicht bei weiteren Exen.
Hallo huetenden !
Es ist nicht nötig, den Quellcode als Grafik anzuhängen !
Öffne in der blauen Featureleiste (oberhalb deines Beitragsfensters) den Punkt für 'Code' (einfach mal mit der Maus über die Punkte fahren). Dort kannst Du dann deinen Quellcode eintragen.
Gruß Musashi
Also ich habe meine Admindaten eingetragen, aber die exe startet nicht als Admin.. woran könnte das liegen?
Also - ohne #RequireAdmin starte die Exe. Dann muss ich aber händisch den haken bein der Lizenzvereinbarung setzen (obwohl dies eigentlich automatisch abluafen sollte) wenn ich den haken setze und auf installieren drücke, will er ein Benutzername und ein Passwort von mir.
Mit RequireAdmin kommt direkt die "Benutzerkontensteuerung" -> Benutzername & Passwort.
Ist ja auch klar, du startest dein Script als Administrator und trägst dort die Daten ein und kannst dann zukünftige Exen starten ohne das nochmal einzutippen.
Wenn du RunAs verwenden willst, dann streiche das #RequireAdmin aus deinem Script und verwende als Benutzer und Kennwort deine Daten und bei Domain
trägst du dann @ComputerName ein, so wie es die Hilfe vorschlägt: https://www.autoitscript.com/autoit3/docs/functions/RunAs.htm
$erg = RunAs("Benutzername", @ComputerName,"Passwort",2, @ScriptDir & "\PlantronicsHubInstaller.exe" )
MsgBox(0,"Debug","$erg=" & $erg & @CRLF & "@error=" & @error )
;Run("PlantronicsHubInstaller.exe")
WinWait("Plantronics Hub Software-Setup")
;Lizenvereinbarung bestätigen und akzeptieren
ControlClick ("Plantronics Hub Software-Setup", "Ich erkläre mich mit der Endnutzer-Lizenzvereinbarung für Plantronics Hub und der Datenschutzerklärung von Plantronics einverstanden – Aktualisiert", "Button2")
ControlClick ("Plantronics Hub Software-Setup", "&Installieren", "Button5")
winWait("Plantronics Hub Software-Setup")
;Installation beendet - Starte Plantronics Software
ControlClick("Plantronics Hub Software-Setup", "&Starten", "Button13")
BlockInput(0)
Alles anzeigen
Klappt leider trotzdem nicht. btw die datei soll nachher so programmiert sein, dass die Personen, die kein Admin haben nur einen Doppelklick auf die fertige exe machen müssen, und im Hintergrund das Programm installiert
Hallo huetenden !
Dann muss ich aber händisch den haken bein der Lizenzvereinbarung setzen (obwohl dies eigentlich automatisch abluafen sollte)
Kann es sein, dass Du hier zwei Bereiche vermischt ?
Punkt 1 : Start des Installers mit Adminrechten aus AutoIt heraus
Punkt 2 : Innerhalb des gestarteten Installers Mausclicks simulieren (z.B. Lizenzvereinbarungen bestätigen)
zu Punkt 1 ist ja bereits vieles gesagt !
Du kannst auch mal folgendes Skript ausprobieren (die jeweilig nicht verwendete Variante auskommentieren)
#include <AutoItConstants.au3>
#include <StringConstants.au3>
#RequireAdmin
Local $iExitCode, $iPID, $sText = ""
; Variante 1 mit RunWait (liefert einen ExitCode zurück) :
$iExitCode = RunWait(@ScriptDir & 'PlantronicsHubInstaller.exe', "", @SW_HIDE)
ConsoleWrite('Exitcode = ' & $iExitCode & @CRLF)
; Variante 2 mit Run (liefert eine ProcessID zurück) :
$iPID = Run(@ScriptDir & 'PlantronicsHubInstaller.exe', "", @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD)
If Not @error Then
ProcessWaitClose($iPID)
$sText = StdoutRead($iPID)
EndIf
ConsoleWrite('STDOUT-Stream = ' & StringStripWS($sText, BitOR($STR_STRIPLEADING, $STR_STRIPTRAILING)) & @CRLF)
Alles anzeigen
zu Punkt 2 :
Prüfe mal im Handbuch/der Anleitung des Installers, ob ein silent oder quiet Modus möglich ist.
Gruß Musashi
Musashi , #RequireAdmin würde aber voraussetzen, dass man beim Start des Scriptes die Daten einträgt und das möchte er ja nicht.
Er will ein Script haben welches ohne Adminrechte einen Installer mit Adminrechten startet, das Problem hierbei ist aber, dass man das gestartete Programm nicht kontrollieren kann, da es mit höheren Rechten gestartet wurde als das ursprüngliche Programm.
Wenn der Installer keinen /silent Switch hat, dann wird man ohne #RequireAdmin im AutoIt-Script (und folglich der benötigten Eingabe des Users+Pw) nicht weit kommen.
Hallo alpines !
Er will ein Script haben welches ohne Adminrechte einen Installer mit Adminrechten startet, das Problem hierbei ist aber, dass man das gestartete Programm nicht kontrollieren kann, da es mit höheren Rechten gestartet wurde als das ursprüngliche Programm.
Das ist mir schon klar, wäre unter Sicherheitsaspekten ja auch nicht unbedingt ein wünschenswertes Szenario. Ich möchte zwar nicht völlig ausschließen, dass es, gerade bei Windows, trotzdem irgendeinen Hack gibt . Davon wäre natürlich abzuraten !!
Bei meinem Punkt 2 ging ich davon aus, dass der Installer bereits korrekt gestartet wurde. Daher der Hinweis auf einen /silent Switch, anstelle von Mausclicksimulationen. In dem Fall wäre die saubere Übergabe von Parametern sicher vorzuziehen.
Eine Silent-Installation ist ja nicht zwingend an die benötigten Rechte gebunden.
Gruß Musashi
Man könnte folgendes versuchen:
Das Script wird gestartet und es wird geprüft ob es mit Adminrechten gestartet wurde, wenn nicht, dann soll eine neue Instanz des Skriptes gestartet werden mit RunAs und den jeweiligen Daten.
Das ursprüngliche Script wird beendet und die neue Instanz, mit erhöhten Rechten, startet dann den Installer und klickt sich dort durch.
Wenn es keinen /silent Switch gibt, dann ist das wohl der einzige Weg der noch übrig bleibt.
Vll kann mans mit der Aufgabenplanung lösen ...
Also erst das Autoit-Skript schreiben (mit #RequireAdmin), dass dann das Installationsprogramm startet... Das Skript dann kompilieren und in der Aufgabenplanung eine Aufgabe erstellen, die das Skript mit erhöhten Rechten startet. Eine Verknüpfung zu dieser Aufgabe setzen und dann sollte der normale Benutzer das Skript ohne Passworteingabe im Adminmode ausführen können
Ich versteh nur Bahnhof.. brauch das halt um in meiner Firma Deutschlandweit die Software zu Installieren.. ohne großen Aufwand..
Und da hat halt leider nicht jeder einen Admin..
Hallo huetenden !
Dass ein Standardbenutzer kein Programm, welches Adminrechte erfordert, starten kann, ohne den Usernamen und das Passwort eines Adminkontos anzugeben, ist ein wichtiger Teil des Sicherheitskonzeptes.
Da Du die Software 'deutschlandweit' installieren möchtest, fällt wahrscheinlich auch die Option weg, diese Daten innerhalb des
Skriptes fest einzutragen. Ich gehe mal nicht davon aus, dass in jeder Filiale ein identisches Adminkonto existiert.
Eine Möglichkeit : Innerhalb des Skriptes mit IsAdmin() prüfen, ob der aktuelle Benutzer über Adminrechte verfügt.
Falls ja :
Starten des Installers über Run() bzw. RunWait()
Falls nein :
Den Usernamen und das Passwort eines Adminkontos z.B. über Inputfelder abfragen, und den Installer über RunAs() bzw. RunAsWait() starten. Damit sollte der Installer im Kontext des Adminkontos ausgeführt werden.
Diesen Weg habe ich aber bisher noch nicht probiert. Ich verwende RunAs() in der Regel, um ein Programm mit eingeschränkten Rechten auszuführen.
Gruß Musashi