Skip to content

Instantly share code, notes, and snippets.

@MyITGuy
MyITGuy / Link-2013-DisableServerCheck.cmd
Created April 18, 2014 13:41
Registry ADD commands for Per-User and Per-Machine allowing Lync 2013 client to connect to Office Communications Server instead of Lync Server
@MyITGuy
MyITGuy / list_filter_members.sql
Last active August 29, 2015 14:01
SMP: List Filter Members
SELECT [conn1].[ResourceGuid]
FROM
[CollectionMembership] [conn1]
LEFT JOIN [vCollection] [conn2] ON [conn1].[CollectionGuid] = [conn2].[Guid]
WHERE [conn2].[Name] = 'Windows Servers'
SELECT [Name] = UPPER([Name])
FROM [vComputer]
WHERE [Guid] IN (
SELECT [conn1].[ResourceGuid]
@MyITGuy
MyITGuy / AeXNSClient_Running.ps1
Created May 23, 2014 12:14
Returns True/False if the AeXNSClient service is in a consistent Running state.
[int]$Seconds = 30
try {
$LastStatus = (Get-Service -Name "AeXNSClient").Status
if ($LastStatus -ne 'Running') {
return $false
} else {
$i = 1
do {
$CurrentStatus = (Get-Service -Name "AeXNSClient").Status
if ($LastStatus -ne $CurrentStatus) {
@MyITGuy
MyITGuy / AeX_TaskHistoryXmlValid.ps1
Created May 23, 2014 12:23
Returns True/False if the TaskHistory.xml is valid.
[string]$xmlFilePath = "$((New-Object -ComObject Altiris.AeXClient).InstallDir)\TaskManagement\statusXml\History\TaskHistory.xml"
# Check the file exists
if (!(Test-Path -Path $xmlFilePath)) {
return $true
}
# Check for Load or Parse errors when loading the XML file
try {
[void](New-Object System.Xml.XmlDocument).Load($xmlFilePath)
return $true
} catch [System.Xml.XmlException] {
@MyITGuy
MyITGuy / hp_print_driver_difxapi.dll_issue.ps1
Created May 27, 2014 13:34
PowerShell: Get size of files pertaining to the HP Print Driver DIFxAPI.dll issue.
(Get-ChildItem -Path "$($env:windir)\System32" | Where-Object {$_.Name -ilike 'SET*.tmp' -and $_.VersionInfo.OriginalFilename -eq 'DIFxAPI.dll'} | Measure-Object -sum Length).Sum / 1MB
@MyITGuy
MyITGuy / Add_Column.sql
Created May 28, 2014 14:29
SQL: Add column to database
ALTER TABLE {TABLENAME}
ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL}
CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE}
ALTER TABLE [L_ContractAssigned]
ADD [ContractAssignedEmpID] VARCHAR(100) NULL
@MyITGuy
MyITGuy / no_arch_wmi.conn.vbs
Created May 31, 2014 18:39
A WMI registry call through VBScript using the StdRegProv class with no architecture specified
Const HKEY_LOCAL_MACHINE = &H80000002, HKLM = &H80000002
Dim StdRegProv: Set StdRegProv = GetObject("winmgmts:{impersonationlevel=impersonate}!//./root/default:StdRegProv")
Dim InstallDir: StdRegProv.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Altiris\Client Service", "InstallDir", InstallDir
WScript.Echo InstallDir
@MyITGuy
MyITGuy / index-windows-1.sucatalog_part1.xml
Created May 31, 2014 19:18
Apple Software Update catalog section example
<key>Packages</key>
<array>
<dict>
<key>Size</key>
<integer>18706944</integer>
<key>URL</key>
<string>http://swcdn.apple.com/content/downloads/15/54/041-303/PnWF3JfCrcJZMdD2RnMNdV694HVVZb3zNT/Safari.msi</string>
</dict>
</array>
@MyITGuy
MyITGuy / show_db_file_sizes.sql
Created July 9, 2014 14:46
SQL: Show Database File Sizes
SELECT
file_id
, name
, type_desc
, physical_name
, size
, max_size
FROM sys.database_files
@MyITGuy
MyITGuy / aex_list_known_agent_names.sql
Created July 17, 2014 13:12
SMP: List known agent names
SELECT DISTINCT [Agent Name], [Ident] FROM [Inv_AeX_AC_Client_Agent] WHERE [Agent Name] IS NOT NULL AND [Ident] IS NOT NULL ORDER BY [Agent Name]