Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. $search_param = read-host "Enter search string: "
  2. $search_param = "*" + $search_param + "*" # Construct search param.
  3. $search_result = Get-ADUser -Filter {Surname -like $search_param -or GivenName -like $search_param -or SamAccountName -like $search_param}
  4.  
  5.  
  6. $search_result | format-table -Property GivenName,Surname,SamAccountName
  7.  
  8. $index=0
  9. Get-Process | Format-Table -Property @{name="index";expression={$global:index;$global:index+=1}},name,handles
  10.  
  11. $procs = Get-Process
  12. #option 1
  13. $procs | Select @{N='Index'; E={$procs.IndexOf($_)}}, name, handles
  14.  
  15. #option 2
  16. $procs | Format-Table -Property @{name="index";expression={$procs.IndexOf($_)}},name,handles
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement