This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ADOrganizationalUnit -Filter 'OU -like "*Citrix*"' -SearchBase 'dc=fabricam,dc=com' -Properties * |% { $_.gpLink -split ']' } |? { $_ -match '[0,2]$'} |% {(($_ -replace '\[','').split(';')[0]) -replace 'LDAP://',''} |% { get-adobject $_ -properties * } | sort -Unique DisplayName | select DisplayName,flags,@{N='flagsRecommended';E={if([bool]( gci "$($_.gPCFileSysPath)\User") -eq $false){if([bool](gci "$($_.gPCFileSysPath)\Machine") -eq $false){3}else{ 1}}else {if([bool](gci "$($_.gPCFileSysPath)\Machine") -eq $false){ 2}ELSE{ 0}} } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ADOrganizationalUnit -Filter 'OU -like "*Citrix*"' -SearchBase 'dc=fabricam,dc=com' -Properties * |% { | |
$_.gpLink -split ']' } |? { | |
$_ -match '[0,2]$'} |% { | |
(($_ -replace '\[','').split(';')[0]) -replace 'LDAP://',''} |% { | |
get-adobject $_ -properties * } | | |
sort -Unique DisplayName | | |
select DisplayName,flags,@{N='flagsRecommended';E={ | |
if([bool]( gci "$($_.gPCFileSysPath)\User") -eq $false){ | |
if([bool](gci "$($_.gPCFileSysPath)\Machine") -eq $false){ | |
3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ADObject -Filter 'ObjectClass -eq "groupPolicyContainer"' -SearchBase 'CN=Policies,CN=System,DC=fabrikam,DC=com' |% { Get-Adobject $_.distinguishedName -properties * } |?{ [bool]( gci "$($_.gPCFileSysPath)\User") -eq $false -and [bool](gci "$($_.gPCFileSysPath)\Machine") -eq $false } | select DisplayName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get-gpo -All |?({ $gpo = get-gporeport -Name $_.DisplayName -ReportType xml; $gpo.GPO.Computer.ExtensionData -eq $null -and $gpo.GPO.User.ExtensionData -eq $null}) | select DisplayName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Branch='LocalMachine' | |
$SubBranch="SOFTWARE\Wow6432Node\Citrix\IMA\RUNTIME" | |
get-xaserver | select ServerNAme,@{N="Session-Only";E={ | |
$registry=[microsoft.win32.registrykey]::OpenRemoteBaseKey($branch,$_.servername) | |
$registrykey=$registry.OpenSubKey($Subbranch) | |
@{$true="Controller";$false="Worker"}[$registrykey.GetValue("WorkerRole") -eq 0] | |
}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get-xaserver |? { $_.IPAddresses -match $MyIp } |? { |select ServerName,@{N="Session";E={@(get-xasession -ServerName $_.ServerName |?{ $_.State -eq "Connected" -and $_.SessionId -gt 0}).Count}} |? { $_.session -eq 0 } |%{ if( $(Get-Xaserver -Servername $_.ServerName).ZoneName -ne $newZone){ set-xaserverzone -ServerNAme $_.Servername -ZoneName $newZone; Restart-Computer $_.ServerName } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get-eventlog -LogName "Key Management Service" -ComputerName "COMPUTER" -InstanceId 1073754114 -After $([datetime]::ParseExact( $(import-csv .\Leases.csv |? { $_.ServerName -eq "COMPUTER" }| select TimeGenerated | sort TimeGenerated -desc | select -First 1).TimeGenerated ,'MM/dd/yyyy HH:mm:ss', $null) ) | select Index,Message,TimeGenerated |% {if ($_.MEssage -match ".*(0x[0-9a-f]+),(\d+),([^,]+),([0-9a-f\-]+),([^,]+),(\d),(\d),(\d+),([0-9a-f\-]+).*") { $_ | Add-Member -type NoteProperty -name Client -Value $matches[3] -Passthru | Add-Member -type NoteProperty -name CMID -Value $matches[4] -PassThru | Add-Member -type NoteProperty -name ErrorLevel -Value $matches[1] -PassThru| Add-Member -type NoteProperty -name MinCount -Value $matches[2] -PassThru| Add-Member -type NoteProperty -name DateDemand -Value $matches[5] -PassThru | Add-Member -type NoteProperty -name isVM -Value $matches[6] -PassThru| Add-Member -type NoteProperty -name State -Value $matches[7] -PassThru | Add-Member -type NoteProperty -name TTLmi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get-eventlog -LogName "Key Management Service" -ComputerName "COMPUTERNAME" -InstanceId 1073754114 | select Index,Message,TimeGenerated |% {if ($_.MEssage -match ".*(0x[0-9a-f]+),(\d+),([^,]+),([0-9a-f\-]+),([^,]+),(\d),(\d),(\d+),([0-9a-f\-]+).*") { $_ | Add-Member -type NoteProperty -name Client -Value $matches[3] -Passthru | Add-Member -type NoteProperty -name CMID -Value $matches[4] -PassThru | Add-Member -type NoteProperty -name ErrorLevel -Value $matches[1] -PassThru| Add-Member -type NoteProperty -name MinCount -Value $matches[2] -PassThru| Add-Member -type NoteProperty -name DateDemand -Value $matches[5] -PassThru | Add-Member -type NoteProperty -name isVM -Value $matches[6] -PassThru| Add-Member -type NoteProperty -name State -Value $matches[7] -PassThru | Add-Member -type NoteProperty -name TTLmin -Value $matches[8] -PassThru | Add-Member -type NoteProperty -name LicenseId -Value $matches[9] -PassThru} } | select @{N="Id";E={$_.Index}},Client,CMID,ErrorLevel,MinCount,TimeGenerated,DateDemand,isVM,S |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get-eventlog -LogName "Key Management Service" -ComputerName "COMPNAME" -InstanceId 1073754114 | select Index,Message |% {if ($_.MEssage -match ".*(0x[0-9a-f]+),(\d+),([^,]+),([0-9a-f\-]+),([^,]+),(\d),(\d),(\d+),([0-9a-f\-]+).*") { $_ | Add-Member -type NoteProperty -name Client -Value $matches[3] -Passthru | Add-Member -type NoteProperty -name CMID -Value $matches[4] -PassThru | Add-Member -type NoteProperty -name ErrorLevel -Value $matches[1] -PassThru| Add-Member -type NoteProperty -name MinCount -Value $matches[2] -PassThru| Add-Member -type NoteProperty -name DateDemand -Value $matches[5] -PassThru | Add-Member -type NoteProperty -name isVM -Value $matches[6] -PassThru| Add-Member -type NoteProperty -name State -Value $matches[7] -PassThru | Add-Member -type NoteProperty -name TTLmin -Value $matches[8] -PassThru | Add-Member -type NoteProperty -name LicenseId -Value $matches[9] -PassThru} } | select @{N="Id";E={$_.Index}},Client,CMID,ErrorLevel,MinCount,DateDemand,isVM,State,TTLmin,LicenseId |% { new-i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get-xaapplication |% { get-xaapplicationreport -BrowserName $_.BrowserName |? { $_.Accounts -contains MyAccount} | select BrowserName } |