ronin2040 Posted December 15, 2012 Share Posted December 15, 2012 (edited) Ive looked through a number of topics trying to get this to work to no avail. Basically, I have some powershell scripts that I want to tie to a GUI, and the commands have to be powershell (theyre active-directory commands that have to be issued through a specific snap-in; doing them straight through AD will fail). I am able to interact with a normal command prompt using stdinwrite and stdoutread, but using the exact same code for powershell simply doesnt work. I wanted to see if anyone has dealt with / solved this issue. Heres an example of the code Im using: Global $data, $title, $pid $pid = Run(@ComSpec, @SystemDir, @SW_SHOW, $STDIN_CHILD + $STDOUT_CHILD) ;WORKS ;;$pid = Run("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit", @SystemDir, @SW_SHOW, $STDIN_CHILD + $STDOUT_CHILD) ; DOES NOT WORK If ProcessWait($pid, 5) Then _StdIn('help /?') _StdIn('ping -w 500 -n 1 8.8.8.8') sleep(2000) _StdOut() EndIf Exit Func _StdIn($input) If Not ProcessExists($pid) Then Return StdinWrite($pid, $input & @CRLF) EndFunc Func _StdOut() If Not ProcessExists($pid) Then Return $output = StdOutRead($pid, 65500) ConsoleWrite($output) EndFunc Edited December 15, 2012 by ronin2040 Link to comment Share on other sites More sharing options...
ronin2040 Posted December 16, 2012 Author Share Posted December 16, 2012 Bump, anyone have any ideas? Link to comment Share on other sites More sharing options...
water Posted December 16, 2012 Share Posted December 16, 2012 (theyre active-directory commands that have to be issued through a specific snap-in; doing them straight through AD will fail).Why do you think the AD commands will fail? There is (almost) nothing you can't do with my AD UDF. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ronin2040 Posted December 16, 2012 Author Share Posted December 16, 2012 The organization I work for uses Quest Active Roles to track changes. From a technical level, I believe you get "access is denied" when attempting to use regular powershell AD commands, and from an administrative, we would want any script we use to have the history recorded by ActiveRoles. Using powershell I can add the quest.activeroles.admanagement pssnapin, which gives access to a whole bunch of cmdlets (see here: http://wiki.powergui.org/index.php/QAD_cmdlets_reference). If there is a way to issue those particular commands natively through autoit, I would love to do so; but as it is I already have a powershell script written to do a number of different functions, and want a GUI over top of it. Link to comment Share on other sites More sharing options...
water Posted December 16, 2012 Share Posted December 16, 2012 I see.Looks like your problem was described - unfortunately there was no solution. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ronin2040 Posted December 17, 2012 Author Share Posted December 17, 2012 Looks like the "solution" unfortunately is to build the GUI directly with winforms, like here. http://bytecookie.wordpress.com/2011/07/17/gui-creation-with-powershell-the-basics/ Probably will work better in the long run anyways, just not as familiar with it. Link to comment Share on other sites More sharing options...
water Posted December 17, 2012 Share Posted December 17, 2012 Looks like a lot of fun My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ptrex Posted January 7, 2013 Share Posted January 7, 2013 @ronin2040Maybe this is a good start Rgdsptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now