Skip to content

Instantly share code, notes, and snippets.

#Connect to ConfigMgr Site
$SiteCode = "SITECODE" #SiteCode - Modify this for your environment
$ProviderMachineName = "SITESERVER" # SiteServer - Modify this for your environment
Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1"
if (-not (Test-Path "$($SiteCode):\")){
New-PSDrive -Name $SiteCode -PSProvider CMSite -Root $ProviderMachineName
}
SELECT sms_r_system.resourceid,
sms_r_system.resourcetype,
sms_r_system.NAME,
sms_r_system.smsuniqueidentifier,
sms_r_system.resourcedomainorworkgroup,
sms_r_system.client
FROM sms_r_system
WHERE sms_r_system.smsuniqueidentifier LIKE "guid:[0]%"
SELECT sms_r_system.resourceid,
sms_r_system.resourcetype,
sms_r_system.NAME,
sms_r_system.smsuniqueidentifier,
sms_r_system.resourcedomainorworkgroup,
sms_r_system.client
FROM sms_r_system
WHERE sms_r_system.smsuniqueidentifier LIKE "guid:[1-2]%"
PowerShell -ExecutionPolicy Bypass -Command "(New-Object -COMObject Microsoft.SMS.TSEnvironment).Value('OSDComputerName') = (Get-CimInstance -Class Win32_BIOS).SerialNumber -replace '-' -replace '^(.{15})(.+)','$1'"
@tstolswo
tstolswo / Royal TS.xml
Created September 24, 2019 18:36
Royal TS recipe for SCCM Application Packager
<ApplicationDef>
<Application>
<Name>Royal TS</Name>
<Description>Royal TS provides powerful, easy and secure access to your remote systems. It's the perfect tool for server admins, system engineers, developers and IT focused information workers who constantly need to access remote systems with different protocols (like RDP, VNC, SSH, HTTP/S, and many more.)</Description>
<Publisher>Royal Applications</Publisher>
<AutoInstall>True</AutoInstall>
<UserDocumentation>https://content.royalapplications.com/Help/RoyalTS/V4/index.html?introduction_yourfirstconnection.htm</UserDocumentation>
<Icon>RoyalTS.ico</Icon>
</Application>
<Downloads>
'Example 1 - dropdown
'OSD environment objects - referenced in the task sequence to name the computer
<SCRIPT LANGUAGE="VBScript">
SET env = CreateObject("Microsoft.SMS.TSEnvironment")
env("APC") = drop_APC.value
<tr>
<td align="right">Airport Code:</td>
<td><select size="1" name="drop_apc">
<option value="ATL">Atlanta, GA (ATL)</option>