Guest User

Untitled

a guest
Sep 4th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  3. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  4.  
  5. Gui, Add, Edit, x36 y26 w140 h310 vMyEdit
  6. Gui, Add, Button, x196 y56 w100 h80 , DisableComputers
  7. Gui, Show, w319 h374, Untitled GUI
  8. return
  9.  
  10. GuiClose:
  11. ExitApp
  12.  
  13. ButtonDisableComputers:
  14. Gui, Submit, NoHide
  15.  
  16. Loop, Parse, MyEdit, `n
  17. {
  18.     Line%A_Index% = %A_LoopField%   ; Put it into Line%A_Index% ( Line1, Line2, Line3, Line4 etc.)
  19.     psScript = %psScript%  get-adcomputer   %A_LoopField%   | Set-ADComputer -Description "Disabled%A_MM%.%A_DD%.%A_YYYY%" -Enabled $false  `n
  20.     psScript = %psScript%  get-adcomputer   %A_LoopField%   | Move-ADObject -TargetPath 'OU=Computers - Disabled,DC=example,DC=com'  `n
  21. }
  22. psScript = %psScript% Read-Host -Prompt "PressEnterToContinue" `n
  23.  
  24. MsgBox %psScript%
  25. RunWait, powershell.exe %psScript%
  26. psScript := ""
  27. GuiControl,, MyEdit,
  28. return
Advertisement
Add Comment
Please, Sign In to add comment