Guest User

Untitled

a guest
Mar 13th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #.foo.ps1
  2. [String]$UserName = $args[0]
  3. [String]$Password = $args[1]
  4. [String[]] $ComputerName = $args[2]
  5. [String[]] $Users = $args[3]
  6. Write-Output "Username is $UserName"
  7. Write-Output "Password is $Password"
  8. foreach ($Computer in $ComputerName) {
  9. Write-Output "Computer is $Computer"
  10. }
  11.  
  12. foreach ($User in $Users) {
  13. Write-Output "Users is $User"
  14. }
  15.  
  16. PS dir>powershell -executionpolicy bypass -Command .foo.ps1 "my_username" "my_password" "Computer1, Computer2" "User1, User2"
  17.  
  18. import subprocess
  19. process = subprocess.Popen(['powershell.exe',"""powershell -executionpolicy bypass -File Foo.ps1 "username" "password" "computer1,computer2" "user1,user2" """], stdin=subprocess.PIPE,stdout=subprocess.PIPE)
  20. print(process.communicate())
Add Comment
Please, Sign In to add comment