Skip to content

Instantly share code, notes, and snippets.

@MyITGuy
MyITGuy / citrix_receiver_kill.cmd
Last active October 1, 2021 22:01
Terminates all Citrix Receiver processes in the current user context.
for %%i in (concentr.exe,receiver.exe,redirector.exe,radeobj.exe,wfcrun32.exe,wfica32.exe,pnamain.exe) do (taskkill /im "%%i" /f)
@MyITGuy
MyITGuy / SQL_Split_String.sql
Last active December 31, 2015 20:59
SQL: Split string using XML
-- Splits a forward-slash delimited value using XML node names
-- COMPANY/COUNTRY/STATE_ABBR/CITY/OFFICE/BUILDING_CODE/NETWORK_TYPE
-- 1. Replace the forward-slash with the end tag and beginning of next tag '/><'
-- 2. Replace any space characters with an underscore character (Node names cannot contain spaces)
-- 3. Add tag start '<' to value
-- 4. Add tag end '/>' to value
-- 5. Cast value as XML
-- 6. Query XML for all node names, returning the 6th value (BUILDING_CODE)
-- 6. Case XML.query as VARCHAR
DECLARE @value VARCHAR(MAX)
@MyITGuy
MyITGuy / OutputObjects_Example.ps1
Last active November 1, 2023 18:58
PowerShell: Output Example
$OutputObjects = New-Object -TypeName PSObject
$OutputObjects = @()
$Objects = Get-CimInstance -Class Win32_Service
foreach ($Object In $Objects) {
$Name = $Object.Name
$OutputObject = New-Object -TypeName PSObject -Property @{
Name = $Name
};
@MyITGuy
MyITGuy / base_silent.cmd
Last active August 29, 2015 13:56
JRE installation wrapper that verifies Java is not in-use at the time of installation
@ECHO OFF
SET JRE_RUNNING=
SET PROBLEM=
SET INST_FILE=%~n1
SET LOG_DIR=%windir%\system32\LogFiles
SET CMD_OPTS= /s REBOOT=ReallySuppress /L*v "%LOG_DIR%\%INST_FILE%_inst.log"
ECHO.
ECHO Check for installer requirements...
ECHO.
@MyITGuy
MyITGuy / AeX_ListPackageServers.ps1
Last active March 13, 2020 12:55
SQL/SMP: List Package Servers
$PackageServers = Get-SMPSQLData -Instances "SQL0040" -Database "Symantec_CMDB_TNKNXSMP01" -CommandText
"SELECT [FQDN] = [conn2].[FQDN], [Name] = UPPER([conn1].[Name]), [IP Address] = [conn1].[IP Address] FROM [vComputer]
[conn1] LEFT JOIN [Inv_AeX_AC_Identification] [conn2] ON [conn1].[Guid] = [conn2].[_ResourceGuid] WHERE [conn1].
[Guid] IN (SELECT DISTINCT [PkgSvrId] FROM [SWDPackageServer]) ORDER BY [conn1].[Name]"
@MyITGuy
MyITGuy / ProcMonAltitude.psm1
Last active April 2, 2024 18:11
Registry settings to adjust ProcMon driver altitude
#region Set-ProcMonAltitude
function Set-ProcMonAltitude {
[CmdletBinding()]
PARAM(
[Parameter(Mandatory = $false, Position = 0)]
[int32[]]
$Version = @(23, 24)
,
[Parameter(Mandatory = $false, Position = 1)]
[int32[]]
@MyITGuy
MyITGuy / AeX_License_Counts.sql
Last active August 29, 2015 13:56
SQL/SMP: Display License Counts
SELECT
[conn2].[Name]
, [conn1].[TotalCount]
, [conn1].[LicenseInUseCount]
, [PercentageUsed] = (
CASE
WHEN [conn1].[LicenseInUseCount] > 0 THEN ROUND(((CAST ([conn1].[LicenseInUseCount] AS FLOAT) / 100.0) / (CAST( [conn1].[TotalCount] AS FLOAT ) / 100.0)) * 100, 2)
ELSE 0
END
)
@MyITGuy
MyITGuy / ruleset_example.xml
Last active August 29, 2015 13:56
Example ruleset.xml
<!-- Example Deployment Rule Set that allow a desktop administrator to control end-user's execution of browser applets.
See http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/deployment_rules.html -->
<ruleset version="1.0+">
<rule>
<id location="http://payroll.example.org" />
<action permission="run" />
</rule>
<rule>
<id location="http://knownvendor.example.com/program" />
<!-- For example if an application is known not to work on Java 1.7 -->
@MyITGuy
MyITGuy / AeX_List_Automation_Policies.sql
Last active February 12, 2016 15:42
SQL/SMP: List Automation Policies
-- List Automation Policies
SET NOCOUNT ON
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SELECT *
FROM [vItem]
WHERE [ClassGuid] = 'BEC44BD0-F31C-43C2-9391-52F176D67A04' -- Altiris.Automation.AutomationPolicies.AutomationPolicy
ORDER BY [Name]
@MyITGuy
MyITGuy / AeX_Show_Automation_Policy_Email_Recipients.sql
Last active October 21, 2015 00:23
SQL/SMP: List Automation Policies Email Addresses (xml)
-- List Automation Policies Email Addresses
SET NOCOUNT ON
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SELECT
[Automation Policy] = [conn1].[Name]
, [TO_EMAIL] = CAST([conn3].[State] AS XML).value('(/item/UniversalTaskManagementDataSourceAdapter/ActionParametersMap/SerializableDictionary/entry/value/ActionParameterMappingTuple[ActionParamName="TO_EMAIL"]/CustomValue/string)[1]', 'varchar(max)')
, [CC_EMAIL] = CAST([conn3].[State] AS XML).value('(/item/UniversalTaskManagementDataSourceAdapter/ActionParametersMap/SerializableDictionary/entry/value/ActionParameterMappingTuple[ActionParamName="CC_EMAIL"]/CustomValue/string)[1]', 'varchar(max)')
FROM
[vItem] [conn1]
-- Connect to Altiris.Automation.AutomationPolicies.ActionDataSourceAdapters.UniversalTaskManagementDataSourceAdapter