Create a somewhat random collection using SMSUniqueIdentifier
This query will allow you to create a somewhat random collection based on the SMSUniqueIdentifier add more or less numbers depending on your target deployment size
1 2 3 4 5 6 7 8 9 |
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 "%[012]" --from SMS_R_System where SMS_R_System.SMSUniqueIdentifier like "%[0123456789ABCDEF]" |
SCCM Client Install – Could not access network location %APPDATA%
Today I was troubleshooting an SCCM Client install issue. checking the CCMSetup.log file the setup was returning “Could not access network location %APPDATA%” To resolve this issue I updated the appdata location under the following registry key
1 |
HKEY_USERS\S-1-5-18\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders |
the location was set to “%APPDATA%” instead of “%USERPROFILE%\AppData\Roaming” after updating this location I was able to successfully […]
SCCM SQL query to list deployments with User Notifications set to show all
Today I needed get a list of deployments that had the user notification set to “Display in Software Center and show all notifications” so I could update the deployments so users would not get the “New Software is Available” toast on available deployments. I was able to use this query to determine this.
1 2 3 4 5 6 |
SELECT [AssignmentName] ,[CollectionName] ,[NotifyUser] ,[EnforcementDeadline] FROM [vSMS_AssignmentBase] WHERE (NotifyUser='1' AND EnforcementDeadline Is Null) |
[…]
Purge Transactional dead-letter queue messages using PowerShell
Here is a snippet I used to purge messages from the System Transactional dead-letter queue using PowerShell.
1 2 3 4 |
[Reflection.Assembly]::LoadWithPartialName("System.Messaging") $msmq = [System.Messaging.MessageQueue] $queuetd = New-Object $msmq("FormatName:Direct=os:.\System$;DEADXACT"); $queuetd.Purge() |
Purge MSMQ Private Queue using PowerShell
I needed to be able to purge all Private Queues using PowerShell. I also needed to have this work on Powershell 3.0. here is the snippet I used to complete this task.
1 2 3 4 5 6 7 8 9 10 |
[Reflection.Assembly]::LoadWithPartialName("System.Messaging") | Out-Null $queues = [System.Messaging.MessageQueue]::GetPrivateQueuesByMachine(".")| % { $_.QueueName } foreach ($q in $queues) { $queuename = ".\" + $q [Reflection.Assembly]::LoadWithPartialName("System.Messaging") | Out-Null $queue = New-Object -TypeName "System.Messaging.MessageQueue" $queue.Path = $queuename $queue.Purge() } |
with Powershell 4.0 you can use Get-MsmQueue
1 2 3 4 5 6 7 8 9 |
$queues = Get-MsmqQueue –QueueType Private | select QueueName foreach ($q in $queues) { $queuename = ".\" + $q.QueueName [Reflection.Assembly]::LoadWithPartialName("System.Messaging") | Out-Null $queue = New-Object -TypeName "System.Messaging.MessageQueue" $queue.Path = $queuename $queue.Purge() } |