Jump to content

[Solved]Cant inser $Variable


Recommended Posts

!Arf it i used [Start new topic] when i was in GUI section and the post was moved without i even noticed it. Can an admin move that to general (SORRY)!

 

Hello guys :) ME again and my ugly english xD.

 

This is the only one powershell command i am not able to use becose i dont found a way to insert the USERNAME $Variable at the first line. i am not able to find a third way to QUOTE a variable when i use "*" for the AutoIt command and the '*' for the PS command but i need to QUOTE inside the '*'PS command my $Variable

 

$iPid = run("powershell get-aduser -Filter {sn -eq 'USERNAME'}  -Properties sAMAccountName,Title"  , @WindowsDir , @SW_HIDE , 0x2)
$AllInfo = ""

 While 1
    $AllInfo &= StdoutRead($iPID)
        If @error Then
            ExitLoop
        EndIf
 WEnd


$AllInfo = stringsplit($AllInfo , @LF , 2) ;split result in all @LF but don't use the splitted result for anything

_ArrayDisplay($AllInfo)

This gonna be my last question becose i can do all the rest (i guess & wish :sweating:) alone

 

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

Palliative logic if that can help someone but ....

 

if there is an other way i am taker.

$iPid = ("powershell get-aduser -Filter {sn -eq '
$iPid2 = $VARIABLE'}  -Properties sAMAccountName,Title"  , @WindowsDir , @SW_HIDE , 0x2)

$Command =Run "$iPid" & "iPid2"

NOT working

 

$USERNAME = InputBox ("test" , "USERNAME")

$iPid = "get-aduser -Filter {sn -eq '"

$iPid2 ="'}  -Properties sAMAccountName,Title")

$Atribut1 =" , @WindowsDir"
$Atribut2 =", @SW_HIDE"
$Atribut3 =", 0x2"
$Atribut4 =0

$Command = run ("powershell"& iPid &$USERNAME& iPid2 )
$AllInfo = ""

 While 1
    $AllInfo &= StdoutRead($Command)
        If @error Then
            ExitLoop
        EndIf
 WEnd

NOT working

 

Lol better like that but not working :

 

$USERNAME = InputBox ("test" , "USERNAME")

$iPid = ("get-aduser -Filter {sn -eq '")

$iPid2 =("'}  -Properties sAMAccountName,Title")

$Atribut1 =(" , @WindowsDir")
$Atribut2 =(", @SW_HIDE")
$Atribut3 =(", 0x2")
$Atribut4 =0

$Command = run ("powershell"& $iPid &$USERNAME& $iPid2 &$Atribut1&$Atribut2&$Atribut3 )
$AllInfo = ""

 While 1
    $AllInfo &= StdoutRead($AllInfo)
        If @error Then
            ExitLoop
        EndIf
 WEnd


$AllInfo = stringsplit($AllInfo , @LF , 2) ;split result in all @LF but don't use the splitted result for anything

_ArrayDisplay($AllInfo)

NOT WORKING

$USERNAME = InputBox ("test" , "USERNAME")

;The wanted command
;~ $iPid = run("powershell get-aduser -Filter {sn -eq 'USERNAME'}  -Properties sAMAccountName,Title"  , @WindowsDir , @SW_HIDE , 0x2)


$Atribut1 = "run"
$Atribut2 = '("powershell get-aduser -Filter '
$Atribut3 = "{sn -eq "
$Atribut4 ="'"
$Atribut5 = $USERNAME
$Atribut6 = "'"
$Atribut7 = "}"
$Atribut8 ='  -Properties sAMAccountName,Title"'
$Atribut9 =" , @WindowsDir , @SW_HIDE , 0x2)"

$Command = $Atribut1&$Atribut2&$Atribut3&$Atribut4&$Atribut5&$Atribut6&$Atribut7&$Atribut8&$Atribut9

Not working GRRRRRRRR

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

Give me one min i am do that now

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

Na :( Empty return = no value

 

Edit no script error

 

Wait i tryed too much thing so i am confused in my original working commandnow let me redo that with the working command

i retry wait a min

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

Neverming first command is working without the Opt

 

you know i tryed similar thing with quote the $Variable was black but it was not working i guess i did a missplell maybe....

 

Thanks

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

If the text is black it means the quotes weren't in the correct place,  Personally I prefer using Opt('ExpandVarStrings', 1) because you can write the variables directly into the string so quotes normally won't matter, it still accepts the original method as well so you can fall back to it.

 

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...