Script library

Boost your management, troubleshooting and remediation capabilities with scripts created by experts in the IT community.

Retrieve Citrix Provisioning Services audit events, if auditing has been enabled although it can be enabled by this SBA if required. Use to see what administrative actions were performed in an optional time window, by whom and what was done. It must be run with the credentials of a user who has been granted PVS access.
Arguments:
Enable Auditing - if auditing is not enabled, specifying true for this parameter will enable auditing if the user running the SBA has sufficient privilege.
Start - optional time to show audit events from. Can be specified as a date/time or as a number of units of time back from the present such as 7d or 1w where s=second,m=minute,h=hour,d=day,w=week,y=year
End - optional time to stop showing audit events after. Can be specified either as a date/time or a number of units of time from the start value specified.
If date/time values are used, they must be enclosed in double quotes, e.g. "02/02/2018 08:00:00"
View Script
Version: 1.3.6  •   Created: 2018-10-23  •   Modified: 2018-11-26
Pull all log separate Citrix StoreFront log files into a single time sorted csv file. You may need to change the StoreFront logging levels first which can be done with the "Show or Change StoreFront Logging" SBA. Use to help diagnose StoreFront issues.
Arguments:
Output csv file - full path to a local or remote file to store the log entries in
Start - optional time to start log export from, e.g. just before the problem started or was reproduced. Can be specified as a date/time or as a number of units of time back from the present such as 7d or 1w where s=second,m=minute,h=hour,d=day,w=week,y=year
End - optional time to stop log export at. Can be specified either as a date/time or a number of units of time from the start value specified.
If date/time values are used, they must be enclosed in double quotes, e.g. "02/02/2018 08:00:00"
View Script
Version: 2.4.7  •   Created: 2018-10-23  •   Modified: 2024-01-26
Add or remove domain or local accounts to/from local groups on selected computers. Can either be done immediately or at a given date/time in the future via a scheduled task, e.g. remove specific users from the local admininstrators group in 1 day's time.
Arguments:
Users - a comma separated list of AD user accounts to add/remove to/from the specified group
Local group - the name of the local group which will have the users added or removed
Remove from group - if true then the specified users will be removed from the group, if false then the users will be added to the group (default is false)
When - If nothing is specified, the action is taken immediately otherwise a scheduled task is created to perform the action at the data/time specified which can also be a number followed by a time unit, e.g. 8h for 8 hours or 1d for 1 day. If specifying a date/time, it must be enclosed in double quotes.
View Script
Version: 1.4.12  •   Created: 2018-10-22  •   Modified: 2018-11-26
Retrieve PVS boot times for a given period from event logs and show them with overall statistics such as fastest, slowest and average boot times. Can help find performance issues. Ensure that each PVS server's stream service has event logging enabled
Arguments:
Last - report on events created in the last x hours/days/weeks, e.g. 7d for last 7 days or 4w for 4 weeks (default is 7 days)
View Script
Version: 1.5.7  •   Created: 2018-10-17  •   Modified: 2018-11-26
Query or change the logging levels in Citrix StoreFront.
Enable more verbose logging when troubleshooting potential StoreFront issues but turn the level back to off or error when finished to reduce the impact on CPU and free disk space.
Arguments:
Cluster - ff set to true then all servers in the cluster will be discovered and reported/operated on rather than just the selected computer (default is false)
Trace Level - specify one of: 'Off', 'Error','Warning','Info','Verbose' or leave empty to query rather than change the current settings (default is empty)
View Script
Version: 1.4.14  •   Created: 2018-10-17  •   Modified: 2018-11-26
Set the page file to a specific drive or full path and its initial and maximum sizes. If the sizes are not specified, or specified as zero, then the page file sizes will be system managed. If the page file location is empty or set to "auto" then the page file will be automatically managed.
A reboot will be required for the changes to take effect.
Arguments:
Page File Location - Either a drive, drive and folder or empty or set to "auto" where the latter two will result in the page file being automatically managed
Initial Size - The initial size of the page file in MB. If zero then sizes will be system managed.
Maximum Size - The maximum size of the page file in MB. If zero then sizes will be system managed.
View Script
Version: 1.3.9  •   Created: 2018-10-14  •   Modified: 2018-11-26
Logoff disconnected sessions on the selected computer(s) which have been disconnected in excess of a given period, specified in minutes.
Arguments:
Disconnected period - the time in minutes over which a user must have been disconnected before they are logged off (default is 10 minutes)
View Script
Version: 1.3.3  •   Created: 2018-10-13  •   Modified: 2018-11-23
Disconnect or logoff sessions on the selected computer(s) which have been idle in excess of a given period, specified in minutes.
Arguments:
Idle Period - the time in minutes after which a disconnected session will be logged off or disconnected depending on the value for the "Logoff" argument (default is 30 minutes)
Logoff - if true, sessions idle in excess of the idle period will be logged off, otherwise they will be disconnected (default is false so sessions will be disconnected)
View Script
Version: 1.5.7  •   Created: 2018-10-13  •   Modified: 2018-11-23
Show configuration for all page files including the path and current and peak usage
View Script
Version: 1.3.7  •   Created: 2018-10-12  •   Modified: 2018-11-26
Cancels any "Message and Logoff" SBAs which are still running on the selected computer(s) by finding the associated PowerShell process and terminating it.
Arguments:
Cancellation Message - A message to display to the users so they can be informed that they will not be logged off (default is no mesage)
View Script
Version: 1.3.3  •   Created: 2018-10-12  •   Modified: 2018-11-23
Send a message to all connected sessions and then log them all off after a specified amount of time. The message can be repeated at a specified interval if required.
For instance, a delay of 15 minutes can be set and the users messaged every 5 minutes with the text specified in the "Message Text" argument.
When the configured script timeout of 60 seconds is reached, an error will be displayed but the script will keep running. If you need to cancel the logoff once the script has timed out, run the "Cancel Logoffs" SBA for the same computer(s)
Arguments:
Message Text - The text of the message to display to all connected users on the selected computer(s)
Delay Before Logoff - The period in minutes from when the script is invoked to when all users will be automatically logged off by the SBA
Message Every - how often, in minutes, the same message is displayed to the remaining users. Specify zero or a blank value to not repeat the message after the initial display
View Script
Version: 1.3.13  •   Created: 2018-10-12  •   Modified: 2018-11-23
Run gpresult for the selected user to get a list of scripts that ran at logon and show where they are located, including the containing GPO's name and GUID, so that it is easy to view the script contents with a view to troubleshooting, optimising, etc. It also shows the size of the script, any parameters passed to it and when it was last modified
View Script
Version: 1.4.9  •   Created: 2018-10-05  •   Modified: 2018-11-20
Run the Sysinternals Process Monitor (procmon) utility for a specified amount of time for a selected process and see which files are most frequently accessed. If a path to an existing procmon executable is not given, it will be downloaded securely from the live.sysinternals.com site.
Arguments:
Monitor Period - the time in seconds to run the monitoring for. Monitoring for more than 60 seconds is not recommended as this can potentially impact system performance and disk space.
Backing file - if not specified this will be in the windowstemp folder on the system drive which on Citrix PVS booted systems can cause performance issues so specifying a file on a persistent local drive can help alleviate this potential issue.
Procmon Location - the location of an existing copy of procmon.exe. If not specified and internet connectivity is available, it will be downloaded.
View Script
Version: 3.10.47  •   Created: 2018-10-01  •   Modified: 2024-01-26
Show the average usage for each CPU over a specified period of time.
Can help to spot overloaded or over specified vCPU allocations for computers although the SBA should be run a number of times, particularly when under peak usage/load.
Arguments:
Capture Period - the number of seconds to monitor CPU usage for
View Script
Version: 1.5.10  •   Created: 2018-09-29  •   Modified: 2018-11-21
Cancel a reboot scheduled via the Schedule Reboot action by finding and deleting the scheduled task created by the Schedule Reboot action
View Script
Version: 1.5.13  •   Created: 2018-09-29  •   Modified: 2018-11-26
Schedule a reboot for a number of minutes/hours in the future by creating a scheduled task which runs once only. By default the reboot will not occur if there are logged on users or disconnected sessions in existence at the scheduled reboot time. This script will not message users, log them off or prevent further logons from occurring.
Arguments:
Minutes:hours - the number of hours/minutes in the future at which to schedule the reboot, e.g. 2:30 for 2 hours and 30 minutes in the future (default is 30 minutes)
Force - if set to true then the reboot will occur even if there are connected or disconnected user sessions at the time of the reboot (default is false)
Reason for Reboot - optional text which be placed in the event log.
View Script
Version: 3.5.11  •   Created: 2018-09-29  •   Modified: 2022-12-14
Capture and analyse network traffic sent for the specified process in a specified time period, showing the IP addresses and DNS names of the remote systems, the port used and the amount of data sent in the capture period.
Arguments:
Capture Time - the number of seconds to run a network capture for (default 15 seconds)
Show top - show only the top n destinations (default is 10)

Credits: based on "Capture Network IO for process" SBA by Andrew Morgan
View Script
Version: 1.6.8  •   Created: 2018-09-26  •   Modified: 2018-11-20
Capture and analyse network traffic sent for all processes in the specified session in a specified time period, showing the IP addresses and DNS names of the remote systems, the port used, the amount of data sent in the capture period and the processes involved.
Arguments:
Capture Time - the number of seconds to run a network capture for (default 15 seconds)
Show top - show only the top n destinations (default is 10)

Credits: based on "Capture Network IO for process" SBA by Andrew Morgan
View Script
Version: 1.4.8  •   Created: 2018-09-26  •   Modified: 2018-11-20
Capture and analyse network traffic sent for all processes on the selected computer in a specified time period, showing the IP addresses and DNS names of the remote systems, the port used, the amount of data sent in the capture period and the processes involved.
Arguments:
Capture Time - the number of seconds to run a network capture for (default 15 seconds)
Show top - show only the top n destinations (default is 10)

Credits: based on "Capture Network IO for process" SBA by Andrew Morgan
View Script
Version: 1.4.7  •   Created: 2018-09-26  •   Modified: 2018-11-20
Capture and analyse network traffic received for all processes on the specified computer in a specified time period, showing the IP addresses and DNS names of the remote systems, the port used, the amount of data received in the capture period and the processes involved.
Arguments:
Capture Time - the number of seconds to run a network capture for (default 15 seconds)
Show top - show only the top n sources (default is 10)

Credits: based on "Capture Network IO for process" SBA by Andrew Morgan
View Script
Version: 1.4.8  •   Created: 2018-09-26  •   Modified: 2018-11-20
  • 15
  • of 23