Jump to content

Recommended Posts

Posted

Working on my first script, please help. The script runs and exits without error but the GUI never displays or prompts for input. what i am trying to do is use an interface to prompt the end user for the requirements to run a command line. Since I've never done this before if you know of a better way please let me know

#include <ButtonConstants.au3>

#include <ButtonConstants.au3>

#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <StatusBarConstants.au3>

#include <TabConstants.au3>

#include <WindowsConstants.au3>

#include <GuiListView.au3>

#include <file.au3>

#include <GuiTab.au3>

#include <IE.au3>

Global $radio1, $radio2, $radio3, $radio4, $nMsg, $radio5, $radio6, $radio7, $radio8, $radio9,$radio10,$radio11,$radio12,$radio13,$radio14,$radio15,$Msg

$TOOLS = GUICreate("GUI", 532, 420, -1, -1)

$PL3 = GUICtrlCreateLabel("Expitation Date MM/DD/YYYY", 8, 328, 75, 34)

$CLO = GUICtrlCreateInput("", 8, 368, 75, 21)

GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")

$PL4 = GUICtrlCreateLabel("Your User Name:", 8, 8, 140, 17)

$Usrnm = GUICtrlCreateInput("", 150, 6, 157, 21)

GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")

$PL5 = GUICtrlCreateLabel("Your Password:", 8, 35, 124, 17)

$Pw = GUICtrlCreateInput("", 150, 35, 157, 21, $ES_PASSWORD)

GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")

; Server RADIO BUTTONS

Func SelectServer()

GuiCtrlCreateGroup("Servers", 35, 85, 230, 150)

$radio1 = GuiCtrlCreateRadio('Server 1', 40, 105, 220)

$radio2 = GuiCtrlCreateRadio('Server 2', 40, 130, 220)

$radio3 = GuiCtrlCreateRadio('Server 3', 40, 155, 220)

$radio4 = GuiCtrlCreateRadio('Server 4', 40, 180, 220)

GUICtrlSetState($radio1, $GUI_CHECKED)

GUISetState()

While 1

$nMsg = GUIGetMsg()

Select

Case $GUI_EVENT_CLOSE

ExitLoop

Case $nMsg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED

$SRV ='Server 1'

Case $nMsg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED

$SRV='Server 2'

Case $nMsg = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED

$SRV='Server 3'

Case $nMsg = $radio4 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED

$SRV='Server 4'

EndSelect

ConsoleWrite ($SRV)

WEnd

EndFunc

; FireCall Users RADIO BUTTONS

Func SelectSFCUser()

GuiCtrlCreateGroup("User ID", 290, 85, 200, 200)

$radio5 = GuiCtrlCreateRadio('user 1', 295, 105, 220)

$radio6 = GuiCtrlCreateRadio('user 2', 295, 130, 220)

$radio7 = GuiCtrlCreateRadio('user 3', 295, 155, 220)

$radio8 = GuiCtrlCreateRadio('user 4', 295, 180, 220)

$radio9 = GuiCtrlCreateRadio('user 5', 295, 205, 220)

$radio10 = GuiCtrlCreateRadio('user 6', 295, 230, 220)

$radio11 = GuiCtrlCreateRadio('user 7', 295, 255, 220)

$radio12 = GuiCtrlCreateRadio('user 8', 295, 280, 220)

$radio13 = GuiCtrlCreateRadio('user 9', 295, 305, 220)

$radio14 = GuiCtrlCreateRadio('user 10', 295, 330, 220)

$radio15 = GuiCtrlCreateRadio('user 11', 295, 355, 220)

GUICtrlSetState($radio1, $GUI_CHECKED)

GUISetState()

While 1

$Msg = GUIGetMsg()

Select

Case $GUI_EVENT_CLOSE

ExitLoop

Case $Msg = $radio5 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED

$FCUSR ='user 1'

Case $Msg = $radio6 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED

$FCUSR='user 2'

Case $Msg = $radio7 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED

$FCUSR='user 3'

Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED

$FCUSR='user 4'

Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED

$FCUSR='user 5'

Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED

$FCUSR='user 6'

Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED

$FCUSR='user 7'

Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED

$FCUSR='user 8'

Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED

$FCUSR='user 9'

Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED

$FCUSR='user 10'

Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED

$FCUSR='user 11'

EndSelect

ConsoleWrite ($Msg)

WEnd

EndFunc

Func launch()

$EX = GUICtrlCreateButton("Execute", 445, 328, 75, 25, 0)

GUICtrlSetState(-1, $GUI_DROPACCEPTED)

GUISetState(@SW_SHOW)

$USN = GUICtrlRead($Usrnm)

If $USN <> '' And $wstn >= '' Then

$USN = '/user:"' & GUICtrlRead($Usrnm)

$PAS = '/password:"' & GUICtrlRead($Pw)

Else

$USN = ''

$PAS = ''

EndIf

$GO = @ComSpec & ' /c wmic /node:' & $SRV & ' "' & $USN & ' (pass is not logged)' & ' process call create ' & ' "' & 'cmd.exe /c net user' & $FCUSR & '/expires:'$CLO '"'

;_FileWriteLog(@TempDir & '\wmic.log')

RunWait(@ComSpec & ' /c wmic /node:' & $SRV & ' "' & $USN & ' "' & $PAS & '" ' & ' process call create ' & & ' "' & 'cmd.exe /c net user' & $FCUSR & '/expires:'$CLO '"')

; Next

;EndIf

;asks if the user would like to execute

If 6 = MsgBox(4, 'Task', 'Completed Task, do you want to exit?') Then

Exit

Else

EndIf

EndFunc

Posted

You lost it. And, please, use Posted Image button to paste your code.

...

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
;        Case
;            ...
;        Case
;            ...
    EndSwitch
WEnd

...
Posted

#include <ButtonConstants.au3>
#include <ButtonConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <StatusBarConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <file.au3>
#include <GuiTab.au3>
#include <IE.au3>


Global $radio1, $radio2, $radio3, $radio4, $nMsg, $radio5, $radio6, $radio7, $radio8, $radio9, $radio10, $radio11, $radio12, $radio13, $radio14, $radio15, $Msg
$TOOLS = GUICreate("GUI", 532, 420, -1, -1)

$PL3 = GUICtrlCreateLabel("Expitation Date MM/DD/YYYY", 8, 328, 75, 34)
$CLO = GUICtrlCreateInput("", 8, 368, 75, 21)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")

$PL4 = GUICtrlCreateLabel("Your User Name:", 8, 8, 140, 17)
$Usrnm = GUICtrlCreateInput("", 150, 6, 157, 21)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")

$PL5 = GUICtrlCreateLabel("Your Password:", 8, 35, 124, 17)
$Pw = GUICtrlCreateInput("", 150, 35, 157, 21, $ES_PASSWORD)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
;        Case
;            ...
;        Case
;            ...
    EndSwitch
WEnd

; Server RADIO BUTTONS
Func SelectServer()

    GUICtrlCreateGroup("Servers", 35, 85, 230, 150)
    $radio1 = GUICtrlCreateRadio('Server 1', 40, 105, 220)
    $radio2 = GUICtrlCreateRadio('Server 2', 40, 130, 220)
    $radio3 = GUICtrlCreateRadio('Server 3', 40, 155, 220)
    $radio4 = GUICtrlCreateRadio('Server 4', 40, 180, 220)
    GUICtrlSetState($radio1, $GUI_CHECKED)
    GUISetState()
    While 1
        $nMsg = GUIGetMsg()
        Select
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $nMsg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
                $SRV = 'Server 1'
            Case $nMsg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
                $SRV = 'Server 2'
            Case $nMsg = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED
                $SRV = 'Server 3'
            Case $nMsg = $radio4 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $SRV = 'Server 4'
        EndSelect
        ConsoleWrite($SRV)
    WEnd
EndFunc   ;==>SelectServer

; FireCall Users RADIO BUTTONS
Func SelectSFCUser()

    GUICtrlCreateGroup("User ID", 290, 85, 200, 200)
    $radio5 = GUICtrlCreateRadio('user 1', 295, 105, 220)
    $radio6 = GUICtrlCreateRadio('user 2', 295, 130, 220)
    $radio7 = GUICtrlCreateRadio('user 3', 295, 155, 220)
    $radio8 = GUICtrlCreateRadio('user 4', 295, 180, 220)
    $radio9 = GUICtrlCreateRadio('user 5', 295, 205, 220)
    $radio10 = GUICtrlCreateRadio('user 6', 295, 230, 220)
    $radio11 = GUICtrlCreateRadio('user 7', 295, 255, 220)
    $radio12 = GUICtrlCreateRadio('user 8', 295, 280, 220)
    $radio13 = GUICtrlCreateRadio('user 9', 295, 305, 220)
    $radio14 = GUICtrlCreateRadio('user 10', 295, 330, 220)
    $radio15 = GUICtrlCreateRadio('user 11', 295, 355, 220)
    GUICtrlSetState($radio1, $GUI_CHECKED)
    GUISetState()
    While 1
        $Msg = GUIGetMsg()
        Select
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $Msg = $radio5 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 1'
            Case $Msg = $radio6 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 2'
            Case $Msg = $radio7 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 3'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 4'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 5'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 6'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 7'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 8'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 9'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 10'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 11'
        EndSelect
        ConsoleWrite($Msg)
    WEnd
EndFunc   ;==>SelectSFCUser

Func launch()
    $EX = GUICtrlCreateButton("Execute", 445, 328, 75, 25, 0)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUISetState(@SW_SHOW)
    $USN = GUICtrlRead($Usrnm)
    If $USN <> '' And $wstn >= '' Then
        $USN = '/user:"' & GUICtrlRead($Usrnm)
        $PAS = '/password:"' & GUICtrlRead($Pw)
    Else
        $USN = ''
        $PAS = ''
    EndIf
    $GO = @ComSpec & ' /c wmic /node:' & $SRV & ' "' & $USN & ' (pass is not logged)' & ' process call create ' & ' "' & 'cmd.exe /c net user' & $FCUSR & '/expires:' $CLO '"'
    ;_FileWriteLog(@TempDir & '\wmic.log')
    RunWait(@ComSpec & ' /c wmic /node:' & $SRV & ' "' & $USN & ' "' & $PAS & '" ' & ' process call create ' & & ' "' & 'cmd.exe /c net user' & $FCUSR & '/expires:' $CLO '"')
    ; Next
    ;EndIf
    ;asks if the user would like to execute
    If 6 = MsgBox(4, 'Task', 'Completed Task, do you want to exit?') Then
        Exit
    Else

    EndIf

EndFunc   ;==>launch

Posted

Yashied thank you for you quick reply, i'm still struggling with this. I have used your example as a template, but having the same result

; Server RADIO BUTTONS Func SelectServer()      GUICtrlCreateGroup("Servers", 35, 85, 230, 150)     $radio1 = GUICtrlCreateRadio('Server 1', 40, 105, 220)     $radio2 = GUICtrlCreateRadio('Server 2', 40, 130, 220)     $radio3 = GUICtrlCreateRadio('Server 3', 40, 155, 220)     $radio4 = GUICtrlCreateRadio('Server 4', 40, 180, 220)     GUICtrlSetState($radio1, $GUI_CHECKED)     GUISetState()     While 1         $nMsg = GUIGetMsg()         Switch $nMsg             Case $GUI_EVENT_CLOSE                 ExitLoop             Case $nMsg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED                 $SRV = 'Server 1'             Case $nMsg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED                 $SRV = 'Server 2'             Case $nMsg = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED                 $SRV = 'Server 3'             Case $nMsg = $radio4 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED                 $SRV = 'Server 4'         EndSwitch         ConsoleWrite($SRV)     WEnd EndFunc   ;==>SelectServer
Posted (edited)

Yashiedthank you for you quick reply, i'm still struggling with this. I haveused your example as a template, but having the same result

;Server RADIO BUTTONS FuncSelectServer()      GUICtrlCreateGroup("Servers", 35, 85, 230, 150)    $radio1 = GUICtrlCreateRadio('Server 1', 40, 105, 220)     $radio2 =GUICtrlCreateRadio('Server 2', 40, 130, 220)     $radio3 =GUICtrlCreateRadio('Server 3', 40, 155, 220)     $radio4 =GUICtrlCreateRadio('Server 4', 40, 180, 220)    GUICtrlSetState($radio1, $GUI_CHECKED)     GUISetState()     While1         $nMsg = GUIGetMsg()         Switch $nMsg             Case$GUI_EVENT_CLOSE                 ExitLoop             Case $nMsg =$radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) =$GUI_CHECKED                 $SRV = 'Server 1'             Case $nMsg =$radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) =$GUI_CHECKED                 $SRV = 'Server 2'             Case $nMsg =$radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) =$GUI_CHECKED                 $SRV = 'Server 3'             Case $nMsg =$radio4 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) =$GUI_CHECKED                 $SRV = 'Server 4'        EndSwitch         ConsoleWrite($SRV)     WEnd EndFunc  ;==>SelectServer
Use the [autoit] tag as follows (without spaces).

[ autoit]; Server RADIO BUTTONS

Func SelectServer()

...

EndFunc[ /autoit]

Edited by Yashied
Posted

Use the

tag as follows (without spaces).

[b][ autoit][/b][color="#808080"]; Server RADIO BUTTONS[/color]
[color="#808080"]Func SelectServer()[/color]

[color="#808080"]...[/color]

[color="#808080"]EndFunc[/color][b][ /autoit][/b][/quote]

I got it now, wow if i can't even post correctly... :)


[code]#include <ButtonConstants.au3>
#include <ButtonConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <StatusBarConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <file.au3>
#include <GuiTab.au3>
#include <IE.au3>


Global $radio1, $radio2, $radio3, $radio4, $nMsg, $radio5, $radio6, $radio7, $radio8, $radio9,$radio10,$radio11,$radio12,$radio13,$radio14,$radio15,$Msg
$TOOLS = GUICreate("GUI", 532, 420, -1, -1)

$PL3 = GUICtrlCreateLabel("Expitation Date MM/DD/YYYY",  8, 328, 75, 34)
$CLO = GUICtrlCreateInput("", 8, 368, 75, 21)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")

$PL4 = GUICtrlCreateLabel("Your User Name:", 8, 8, 140, 17)
$Usrnm = GUICtrlCreateInput("", 150, 6, 157, 21)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")

$PL5 = GUICtrlCreateLabel("Your Password:", 8, 35, 124, 17)
$Pw = GUICtrlCreateInput("", 150, 35, 157, 21, $ES_PASSWORD)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")

; Server RADIO BUTTONS
Func SelectServer()

    GUICtrlCreateGroup("Servers", 35, 85, 230, 150)
    $radio1 = GUICtrlCreateRadio('Server 1', 40, 105, 220)
    $radio2 = GUICtrlCreateRadio('Server 2', 40, 130, 220)
    $radio3 = GUICtrlCreateRadio('Server 3', 40, 155, 220)
    $radio4 = GUICtrlCreateRadio('Server 4', 40, 180, 220)
    GUICtrlSetState($radio1, $GUI_CHECKED)
    GUISetState()
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $nMsg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
                $SRV = 'Server 1'
            Case $nMsg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
                $SRV = 'Server 2'
            Case $nMsg = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED
                $SRV = 'Server 3'
            Case $nMsg = $radio4 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $SRV = 'Server 4'
        EndSwitch
        ConsoleWrite($SRV)
    WEnd
EndFunc   ;==>SelectServer

; FireCall Users RADIO BUTTONS
Func SelectSFCUser()

    GUICtrlCreateGroup("User ID", 290, 85, 200, 200)
    $radio5 = GUICtrlCreateRadio('user 1', 295, 105, 220)
    $radio6 = GUICtrlCreateRadio('user 2', 295, 130, 220)
    $radio7 = GUICtrlCreateRadio('user 3', 295, 155, 220)
    $radio8 = GUICtrlCreateRadio('user 4', 295, 180, 220)
    $radio9 = GUICtrlCreateRadio('user 5', 295, 205, 220)
    $radio10 = GUICtrlCreateRadio('user 6', 295, 230, 220)
    $radio11 = GUICtrlCreateRadio('user 7', 295, 255, 220)
    $radio12 = GUICtrlCreateRadio('user 8', 295, 280, 220)
    $radio13 = GUICtrlCreateRadio('user 9', 295, 305, 220)
    $radio14 = GUICtrlCreateRadio('user 10', 295, 330, 220)
    $radio15 = GUICtrlCreateRadio('user 11', 295, 355, 220)
    GUICtrlSetState($radio1, $GUI_CHECKED)
    GUISetState()
    While 1
        $Msg = GUIGetMsg()
        Switch $Msg
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $Msg = $radio5 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 1'
            Case $Msg = $radio6 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 2'
            Case $Msg = $radio7 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 3'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 4'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 5'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 6'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 7'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 8'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 9'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 10'
            Case $Msg = $radio8 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                $FCUSR = 'user 11'
        EndSwitch
        ConsoleWrite($Msg)
    WEnd
EndFunc   ;==>SelectSFCUser

Func launch()
    $EX = GUICtrlCreateButton("Execute", 445, 328, 75, 25, 0)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUISetState(@SW_SHOW)
    $USN = GUICtrlRead($Usrnm)
    If $USN <> '' And $wstn >= '' Then
        $USN = '/user:"' & GUICtrlRead($Usrnm)
        $PAS = '/password:"' & GUICtrlRead($Pw)
    Else
        $USN = ''
        $PAS = ''
    EndIf
    $GO = @ComSpec & ' /c wmic /node:' & $SRV & ' "' & $USN & ' (pass is not logged)' & ' process call create ' & ' "' & 'cmd.exe /c net user' & $FCUSR & '/expires:' $CLO '"'
    ;_FileWriteLog(@TempDir & '\wmic.log')
    RunWait(@ComSpec & ' /c wmic /node:' & $SRV & ' "' & $USN & ' "' & $PAS & '" ' & ' process call create ' & & ' "' & 'cmd.exe /c net user' & $FCUSR & '/expires:' $CLO '"')
    ; Next
    ;EndIf
    ;asks if the user would like to execute
    If 6 = MsgBox(4, 'Task', 'Completed Task, do you want to exit?') Then
        Exit
    Else

    EndIf

EndFunc   ;==>launch

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...