
Balragh
Members-
Posts
9 -
Joined
-
Last visited
Everything posted by Balragh
-
adding a variable inside a PowerShell command
Balragh replied to Balragh's topic in AutoIt General Help and Support
AMENO. Thanks so much mysterious @Nine for the help, for the rest, I think I'll just tinker around to make it cleaner- 10 replies
-
- gui
- powershell
-
(and 1 more)
Tagged with:
-
adding a variable inside a PowerShell command
Balragh replied to Balragh's topic in AutoIt General Help and Support
- 10 replies
-
- gui
- powershell
-
(and 1 more)
Tagged with:
-
adding a variable inside a PowerShell command
Balragh replied to Balragh's topic in AutoIt General Help and Support
Thank you for your time, Just tried you solution but the same extact problem occurs, the msgbox opens empty The GUICtrlRead is working fine and the command also, but when it reaches the msgbox it's empty 😕- 10 replies
-
- gui
- powershell
-
(and 1 more)
Tagged with:
-
adding a variable inside a PowerShell command
Balragh replied to Balragh's topic in AutoIt General Help and Support
Just added the -noexit to the command and it's working fine, the command is successful. for the horrible while I have so far, it looks like this : While 1 $idMsg = GUIGetMsg() $snumber = GUICtrlRead($inputSnumber) $sPSCmd = "Get-ADUser -Identity" & " '" & $snumber & "' " & "-Properties 'LastLogonDate'| Select-Object Name, LastLogonDate" Switch $idMsg Case $GUI_EVENT_CLOSE ExitLoop Case $config $pwCMD = Run(@comspec & ' /c powershell.exe -NoExit -command "&' & $sPSCmd) ProcessWaitClose($pwCMD) msgbox($MB_SYSTEMMODAL,"",StdoutRead($pwCMD) & @CRLF) EndSwitch WEnd- 10 replies
-
- gui
- powershell
-
(and 1 more)
Tagged with:
-
adding a variable inside a PowerShell command
Balragh replied to Balragh's topic in AutoIt General Help and Support
Thanks for this solution, but when trying to consolowrite or msgbox it, it's not showing anything. Basically what i'm trying to do is to get the returned last logon and show it in the GUI.- 10 replies
-
- gui
- powershell
-
(and 1 more)
Tagged with:
-
adding a variable inside a PowerShell command
Balragh replied to Balragh's topic in AutoIt General Help and Support
Ok thanks guys, I just had to get the input read from inside the while .. my mistake. Now it's working fine. Just have to find how to get the response from powershell which seems to be an other problem haha I naively tried to set the command as a variable et print what's inside but no luck of course : $response = RunWait(@comspec & ' /c ' & 'powershell.exe -command "&' & $sPSCmd & '"') but of course that does not do the trick. If you still have an idea on this, I will keep locking if someone had the same problem I had- 10 replies
-
- gui
- powershell
-
(and 1 more)
Tagged with:
-
Hello, First of all i'm new and not that good at coding in general, i'm trying to create a simple gui that will achieve a simple goal : * one input (username) * one button (start a powershell with the inputT used) So far I have this going : #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> ;Creating GUI GUICreate("search last logon",150,110) GUICtrlCreateLabel("Entrer un Snumber",30,20,200,30) $inputSnumber = GUICtrlCreateInput("",25,35,100,20) $config = GUICtrlCreateButton("Lancer recherche", 25, 60, 100, 20) $snumber = GUICtrlRead($inputSnumber) $sPSCmd = "Get-ADUser -Identity" & $snumber & "-Properties 'LastLogon'| Select-Object Name, @{N='LastLogon'; E {[DateTime]::FromFileTime($_.LastLogon)}}" ;affichage de la fenêtre GUISetState(@SW_SHOW) While 1 $idMsg = GUIGetMsg() Switch $idMsg Case $GUI_EVENT_CLOSE ExitLoop Case $config RunWait(@comspec & ' /c powershell.exe -nologo -executionpolicy bypass -WindowStyle hidden -noprofile -command "&' & $sPSCmd & '"') ;trying to find why this does not work ;( MsgBox($MB_SYSTEMMODAL,"", GUICtrlRead($inputSnumber)) MsgBox($MB_SYSTEMMODAL,"",$sPSCmd) EndSwitch WEnd I tried this thingy : $sPSCmd = "Get-ADUser -Identity" & $snumber & "-Properties 'LastLogon'| Select-Object Name, @{N='LastLogon'; E {[DateTime]::FromFileTime($_.LastLogon)}}" with & $snumber & or directly GUICtrlRead($inputSnumber) but, when outputting the command ($sPSCmd) the variable does not shows up. Would someone be kind enough to give this a try and guide me ? Thanks again from a baguette technician
- 10 replies
-
- gui
- powershell
-
(and 1 more)
Tagged with:
-
Hello, Thanks a lot, the thing that was blocking was the missing ShellExecuteWait( "C:\SWSetup\" & . Now it finally installs that BIOS update but .. at the end of the script, every folder and subfolder are being opened not just the HpFirmwareUpdRec.exe. Would there be a way to prevent that ? The complete portion of script I have is this : #RequireAdmin #include <MsgBoxConstants.au3> #include <File.au3> $model = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS", "SystemProductName") $versionOs = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "DisplayVersion") $arrayexe = _FileListToArray(@WorkingDir & "\Driver\" & $model & "\BIOS" , "*.exe", 1, True) For $i = 1 To $arrayexe[0] ShellExecuteWait($arrayexe[$i], "/s /e") Next Sleep(3000) $arraybios = _FileListToArrayRec("C:\SWSetup" , "HpFirmwareUpdRec.exe",$FLTAR_FILESFOLDERS, $FLTAR_RECUR) For $i = 1 To $arraybios[0] ShellExecuteWait("C:\SWSetup\" & $arraybios[$i], "-s -r") Next MsgBox($MB_SYSTEMMODAL, "", "fin du script")
-
Hello everyone, this is my first post here, I'm trying to create a script that search for a specific file inside a directory here "HpFirmwareUpdRec.exe" inside C:/SWSetup. something like : C:/SWSetup -> SPXXXX ->SPXXXX ->SPXXXX "HpFirmwareUpdRec.exe" I tried to use _FileListToArrayRec but I getting only errors 😕 Here is what I have so far : $model = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS", "SystemProductName") $versionOs = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "DisplayVersion") $arrayexe = _FileListToArray(@WorkingDir & "\Driver\" & $model & "\BIOS" , "*.exe", 1, True) For $i = 1 To $arrayexe[0] ShellExecuteWait($arrayexe[$i], "/s /e") Next Sleep(3000) $arraybios = _FileListToArrayRec(@"C:\SWSetup" , "HpFirmwareUpdRec.exe",$FLTAR_FILESFOLDERS, $FLTAR_RECUR) For $i = 1 To $arraybios[0] ShellExecuteWait($arraybios[$i], "-s -r") Next MsgBox($MB_SYSTEMMODAL, "", "fin du script") Would you have any suggestion on what I can do to