Jump to content

[SOLVED]PowerShell result


Recommended Posts

Hello.

I improved my powershell skill like F**** !! I am so happy Level skill under beginner HAHA well i am just getting what i want but now i got a question about autoit + powershell

When i run that Shellcommand 

$iPid = run("Powershell Get-ADUser USER -Properties * | select -Expand Title"  , @WindowsDir , @SW_HIDE , 0x2)

 

The return valu is :

Micro r,seau (this is normal in PowerShell)

Can i transform the value

Micro réseau with autoit 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Try:

$iPid = Run('PowerShell Get-ADUser USER -Properties * | Select -Expand Title', '' , @SW_HIDE , 0x2)
$sOutput = ''
While 1
    $sOutput &= StdoutRead($iPID)
        If @error Then ExitLoop
WEnd
$sOutput = _WinAPI_MultiByteToWideChar($sOutput, 1, 0 , 1)
ConsoleWrite('$sOutput := ' & $sOutput & @CRLF)

Personally I prefer the AD UDF from Water

a. It doesn't require installing Remote Server Administrator Tools on Windows 7/8/10 (required for PowerShell Active Directory module)

b. Doesn't require running multiple PowerShell Commands to obtain the same information

For example:

#include <AD.au3>
_AD_Open()
    $FirstName = _AD_GetObjectAttribute(@Username, 'givenName')
    $Surname =  _AD_GetObjectAttribute(@Username, 'sn')
    $Title =  _AD_GetObjectAttribute(@Username, 'Title')
    $Mobile =  _AD_GetObjectAttribute(@Username, 'Mobile')
_AD_Close()
ConsoleWrite($FirstName & @CRLF & $Surname & @CRLF & $Title & @CRLF & $Mobile & @CRLF)

 

Link to comment
Share on other sites

(Sorry my english but i also trying to improve myself day after day)

First of all thanks becose you solved my problem but for me it s palliative solution.

EDIT: you answered to my ps + au3 probleme 1000 thx. it s working perfectly

 

Now i unswer you.

-I want improve my skill like in all my post.

8 years ago i was at Level 0. Now a dev with AD script powershellscript  AU3 script and VB script.

I want dodge the maximum of UDF use becose the work is already done. And maybe one day in a perfect world :D. I am gonna be able to make my own UDF to help this superb community.

 

Now may you can unswer that becose i dont got an user on witch one i can test. And i dont want to make an new user just for testing (i got the rights to do it but i dont want to do that for dev purpose).

 

Will that wotk if the translating error from PS is not at the same place ? or that solution is only for that PS command ?

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Q1: "Now may you can unswer that becose i dont got an user on witch one i can test. And i dont want to make an new user just for testing (i got the rights to do it but i dont want to do that for dev purpose)."

A1: If you are only using "Get-ADUser" (read-only) you can generally read any users details as its not going to have any effect on Active Directory, for example I don't have accent characters in my name or Title, so I just found another user in AD that did and tested the solution above by switching "USER" for that persons Username using my non-admin account so you should be able to test on any account without creating a new user.

Q2: "Will that wotk if the translating error from PS is not at the same place ? or that solution is only for that PS command ?"

A2: The solution above should work above for any string

Link to comment
Share on other sites

Thnks.

 

We are only 100 and unfortunatly no accent in any name surname nickname Nmaaccountname etc.... so i was wondering :)

Thx.

 

 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...