Tuesday, April 24, 2012
Powershell - Citrix
load citrix ps adding : Add-PSSnapin Citrix.XenApp.Commands
Get the number of sessions in the farm:
$FarmRaw = Get-XAFarm
$FarmRaw.SessionCount
Get the number of sessions per app:
$Sessions = Get-XASession -BrowserName "Notepad"
$SessTotal = $sessions.count
Tuesday, April 3, 2012
Powershell : Active Directory user update and rename in 1 line
# tested and used on powershell v3
# 1 Grab username\password
# 2 Grab all users without admin in the name
# 3 For each user
# a Modify display name to include (admin)
# b Rename AD object to include (admin)
#
#It’s setup to run in a single line because I can
#
expanded
#get the admin passwords
# 1 Grab username\password
# 2 Grab all users without admin in the name
# 3 For each user
# a Modify display name to include (admin)
# b Rename AD object to include (admin)
#
#It’s setup to run in a single line because I can
#
$ninja=Get-Credential
; get-aduser -filter
'name -notlike "*Admin*"' -searchbase 'OU=Security - Administrator Accounts,DC=Coolkids,DC=local' -Properties DistinguishedName
| %{set-aduser -credential $ninja
$_ -displayname
($_.name
+ "
(Admin)"); rename-ADObject $_.DistinguishedName
-credential
$ninja -NewName
($_.name
+ "
(Admin)")}
expanded
#get the admin passwords
$ninja=Get-Credential
#
get-aduser -filter 'name -notlike "*Admin*"' -searchbase 'OU=Security - Administrator Accounts,DC=Coolkids,DC=local' -Properties DistinguishedName | %{set-aduser -credential $ninja $_ -displayname ($_.name + " (Admin)"); rename-ADObject $_.DistinguishedName -credential $ninja -NewName ($_.name + " (Admin)")}
#
get-aduser -filter 'name -notlike "*Admin*"' -searchbase 'OU=Security - Administrator Accounts,DC=Coolkids,DC=local' -Properties DistinguishedName | %{set-aduser -credential $ninja $_ -displayname ($_.name + " (Admin)"); rename-ADObject $_.DistinguishedName -credential $ninja -NewName ($_.name + " (Admin)")}
Subscribe to:
Posts (Atom)