Skip to content

Instantly share code, notes, and snippets.

@belotn
belotn / get-citrixadminfromuser.ps1
Last active December 11, 2015 21:38
Récupérer rapidement les privilèges Citrix d'un compte ActiveDirectory
$Searcher = New-Object DirectoryServices.DirectorySearcher
$Searcher.Filter = '(&(objectCategory=User)(sAMAccountName=MyUser))'
$Searcher.SearchRoot = 'LDAP://dc=ds,dc=example,dc=com'
$user = [adsi]$Searcher.FindAll()[0].Path
$groups = @($user.memberOf | % { ([adsi]"LDAP://$_").Cn })
$admin = @(Get-xaadministrator | select AdministratorName | % { $_.AdministratorNAme.Split()[0] })
$mygroup = compare-object $groups $admin -ExcludeDifferent -IncludeEqual -Passthru
@belotn
belotn / get-notinstalledpackages.ps1
Last active December 11, 2015 23:08
Récupérer les serveurs n'ayant pas installé un package!
$xaservers = New-Object System.Collections.ArrayList
get-xaserver | select ServerName | sort ServerName | %{ $xaservers.Add( $_.ServerName ) }
$jobname = "MyPackage"
$IMSetting = new-object -com MetaframeCOM.MetaFrameIMConfig;
$IMSetting.jobs | % {
if( $_.name -match $jobname){
$_.Servers | % {
if( $_.jobStatus -eq 0 -or $_.jobStatus -eq 8 ){
@belotn
belotn / move-datastore.ps1
Last active December 13, 2015 22:48
Change datastore configuration on all farm servers
$username ="MyUser"
$password="MyPwd"
$dsnfilename="Path/to/my/newdsn"
Get-xaserver |% {
$serverName = $_.servername
$servername
get-content New.dsn |%{ if ($_ -like '*WSID*') {"WSID=$servername" }else{$_} } | out-file "\\$($_.ServerNAme)\c$\Path\to\newdsn"
@belotn
belotn / add_server.ps1
Last active December 15, 2015 11:38
One liner, ajout de serveur dans un pool d'application
get-xaapplication MyApp-* |% { set-xaapplication -InputObject $_ -ServerNames (@(get-xaserver -BrowserName $_.BrowserName | %{$_.ServerName } ) + @('MyServer1', 'MyServer2')) }
@belotn
belotn / disable_mutlipleinstance.ps1
Last active December 15, 2015 11:38
One liner ; une seul instance d'appli par utilisateur
get-xaapplication | where { $_.MultipleInstancesPerUserAllowed -eq $True } |%{ set-xaapplication -InputObject $_ -MultipleInstancesPerUserAllowed $false }
@belotn
belotn / checkXML.ps1
Last active March 31, 2020 04:09
Script to check the Citrix XML Services
@(MyXMLServerList)| select @{N="Server";E={$_}},@{N="State";E={
$url="http://${_}:8085/scripts/wpnbr.dll"
$data = '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
<NFuseProtocol version="4.1">
<RequestAddress>
<Flags>no-load-bias</Flags>
<Name>
<AppName>MyApp</AppName>
</Name>
@belotn
belotn / IISListIP.ps1
Created April 17, 2013 16:14
OneLiner to List connecting IPs from IIS Logs
get-content "Path/To/File" |? { $_ -notlike "#[D,S-V]*"} |%{ @($_.Split(" "))[8] }|sort | group | select Name,Count,@{N='HostName',E={[system.net.dns]::GetHostEntry($_.Name}.HostName } }
@belotn
belotn / activateFolder.ps1
Created May 15, 2013 08:43
Enable all disabled applications in a Fodler
get-xaapplication -FolderPath Applications/Path |? {$_.Enabled -eq $false } | set-xaapplication -Enabled $true
@belotn
belotn / generate_chart.ps1
Created May 28, 2013 16:34
Generate Google chart From CSV _ DateTime;CCU
$html ="<html>
<head>
<!--Load the AJAX API-->
<script type=`"text/javascript`" src=`"https://www.google.com/jsapi`"></script>
<script type=`"text/javascript`">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
@belotn
belotn / export_folder.ps1
Created June 19, 2013 12:17
Extract all application in a folder
get-xafolder Applications/Path |%{ $_; get-xaapplication -FolderPath $_| select DisplayName |%{“`t$($_.DisplayName)” } }