Thanks for leading me in the right direction. For those who are interested, here's the code to do it... almost. Question for you Powershell gurus. Only problem with this is even with the -Force on the removal cmdlet, it still prompts me for each and every one "Are you sure you want to remove UserAffinityFromDevice from ResourceID = xxxx". Can you see anything below that might be causing that? I really don't want to have to click Yes a couple thousand times :)
# Get all administrator defined UDA (Sources = 2)
$UDAs = Get-CMUserDeviceAffinity -Username "LAB\*" | select UniqueUserName,
ResourceID, Sources | Where-Object {$_.Sources -like '*2*'}
# Remove each UDA association
ForEach ($UDA in $UDAs) {
Remove-CMUserAffinityFromDevice -DeviceId $UDA.ResourceID -UserName
$UDA.UniqueUserName -Force
}
From: [email protected] [mailto:[email protected]] On
Behalf Of Daniel Ratliff
Sent: Friday, January 17, 2014 11:31 AM
To: [email protected]
Subject: [mssms] RE: Remove all admin defined UDA
Heres an example on how to create it, just need to modify it a bit for removal.
http://cm12sdk.net/?p=1480
An example of how to remove:
http://blog.msvconsultancy.co.uk/2013/06/sccm-2012-user-device-affinity-window-managerdwm-1/
Daniel Ratliff
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Beardsley, James
Sent: Friday, January 17, 2014 11:18 AM
To: [email protected]<mailto:[email protected]>
Subject: [mssms] Remove all admin defined UDA
Is there a way to remove only the administrator defined UDA for all users? If
not, whats the best way to just remove all UDA, both admin and usage defined.
Thanks,
James Beardsley | Firm Technology Group
Dixon Hughes Goodman LLP
[Description: Description: Description: cid:[email protected]]
________________________________
IRS Compliance: Any tax advice contained in this communication (including any
attachments) is not intended or written to be used, and cannot be used, for the
purpose of (i) avoiding penalties imposed under the Internal Revenue Code or
applicable state or local tax law or (ii) promoting, marketing, or recommending
to another party any transaction or matter addressed herein.
________________________________
Confidentiality Notice: This e-mail is intended only for the addressee named
above. It contains information that is privileged, confidential or otherwise
protected from use and disclosure. If you are not the intended recipient, you
are hereby notified that any review, disclosure, copying, or dissemination of
this transmission, or taking of any action in reliance on its contents, or
other use is strictly prohibited. If you have received this transmission in
error, please reply to the sender listed above immediately and permanently
delete this message from your inbox. Thank you for your cooperation.
The information transmitted is intended only for the person or entity to which
it is addressed
and may contain CONFIDENTIAL material. If you receive this material/information
in error,
please contact the sender and delete or destroy the material/information.
________________________________
IRS Compliance: Any tax advice contained in this communication (including any
attachments) is not intended or written to be used, and cannot be used, for the
purpose of (i) avoiding penalties imposed under the Internal Revenue Code or
applicable state or local tax law or (ii) promoting, marketing, or recommending
to another party any transaction or matter addressed herein.
________________________________
Confidentiality Notice: This e-mail is intended only for the addressee named
above. It contains information that is privileged, confidential or otherwise
protected from use and disclosure. If you are not the intended recipient, you
are hereby notified that any review, disclosure, copying, or dissemination of
this transmission, or taking of any action in reliance on its contents, or
other use is strictly prohibited. If you have received this transmission in
error, please reply to the sender listed above immediately and permanently
delete this message from your inbox. Thank you for your cooperation.
<<inline: image001.jpg>>

