Friday, May 5, 2017

User Device Affinity (UDA) in C#

With the demise of Silver Light, you might want to keep it just so you can do UDA for the users.  Well here is some code you can use to create a webpage, much like I did to go around that issue.


Here is some straight code:

First you need to search for the user you want to add:
Create a Text box named UserSelected
Now search for the user based on the name, this will also contain their userID so it helps with the searches.


string strQuery = "Select * from SMS_R_User where Name like '%" + UserSelected.Trim() + "%'";
IResultObject UsersFound = SCCMconnection.QueryProcessor.ExecuteQuery(strQuery);


Now you can move through the list and add them to the radio button if you like.


foreach (IResultObject UserFound in UsersFound)
{
dt.Rows.Add(CreateRow(UserFound["UniqueUserName"].StringValue.Trim(), UserFound["Name"].StringValue.Trim(), dt));
dv = new DataView(dt);
}
UniqueUserName-  This is what SCCM needs in order to add the user domain\userid
UserFound["Name"] - this is used for our searches because it looks like this (userID\domain  Username ResourceID)
Next you can create a search for the machine,

SMS_CM_RES_COLL_XY000017 - This is your collection of machines you wish to search, this could be your AllWorkstations collection


Select ResourceID,Name from SMS_CM_RES_COLL_XY000017 where name like '%" + FindComputerTxtBox.Text.Trim() + "%'";


Once you find it add it to a drop down box. 
Now with both the user and the Machine we can set the UDA.  Be sure your Security on the Service Account performing the action has access to set User Device Affinity.

Dictionary<string, object> addUDAParameters = new Dictionary<string, object>();
addUDAParameters.Add("MachineResourceId", ResourceIDVariable);
addUDAParameters.Add("UserAccountName", "domain\userid";
addUDAParameters.Add("SourceId", "2");  //Administrative change
addUDAParameters.Add("TypeId", "1");
IResultObject UDA = SCCMconnection.ExecuteMethod("SMS_UserMachineRelationship", "CreateRelationship", addMembershipRuleParameters);




Depending on what you use the Application Catalog for, you can use this code on a website and remove SilverLight.

Tuesday, May 2, 2017

What is Managed Mobile Convergence and why is it important to my business?



Managed Mobile Convergence is the ability to manage a mobile device, desktops or even servers as the same machine.  Think of as treating everyone the same not matter what!!  Let’s outline some definitions because as the lines blur so do the meaning.
Mobile Device – traditionally we would refer to these as smart devices like smart phones but now see laptops and tablets slowly move into this area.
IoT Devices – Internet of Things- We use to call these embedded devices.  They were sometimes dumb devices that might have linked to a central control, had a small storage and ran PIC but now the name has changed and so have the usability.  These devices are as smart as Mobile devices and sometimes run a modern OS like Windows 10 or Linux. 
Workstations / Desktops – Machines we use for our daily work and play.  These devices use a full OS like Apple, Linux, Windows and are work hard.  These machines are now blurring between our work pc and the home pc with the Bring Your Own Device initiative.
Now what is left out of all this conversation are servers.  Servers have moved from closets to rooms to “server room” and now to the Data Center.  In all our management views, we traditionally leave server management up to the Server admins.  Even today Servers are treated differently that other devices. 
Intune currently doesn’t support Server but it has slowly provided more modern management of the mobile workstations like Win10 devices and can also manage the desktop for smaller organizations. This is a great idea but be aware that part of this solution is no reimage, yet.  Now we have Win10 provisioning, MDT and other solutions.  Using this perspective MS is looking to move you to the Cloud, “Modern Management” and with no more on-prem management infrastructure like SCCM.  This can save money but you still need to manage your server environments. 


https://twitter.com/msintune
I see your “Modern Management” and raise you “Managed Mobile Convergence”.  The ability to manage all devices globally, without prejudice.  Smart phone, Workstation, Laptop, BYOD, Tablet, Server as well as Operating System Agnostic all utilizing a single pane of glass.  To begin to see this world we must place a blinder on the use of the machine and look at it from the perspective as business device, nothing more.  If the device needs antivirus/antimalware it should be managed, even if that means Microsoft devices pull from MS and the Apple Devices pull from Apple, all the while talking to the same management infrastructure.  The machine policies should be the same even if the signatures are from different vendors.  I should have a single pane of glass to create an exemption for a virus alert, file type, etc.
We see this partly in SCCM with the Adroid for Work, Mac support, Servers and many different types of machines.  To truly reach our goal of Managed Mobile Convergence we must treat every device as equal.  That would mean if we want to deploy an update to an Apple, Workstation, Server, IoT device it should be a single solution with a single interface. 
I am only discussing the management of the machine. I am leaving out the trade compliance issue of data entering or leaving counties, client data in the cloud.  These problems will always exist and there for complicate the infrastructure to manage these devices.  For this reason we will always need a kind of hybrid approach for management.  That is a discussion for later….

Wednesday, February 22, 2017

BIOS Report for Dell and HP

When moving to Windows 10, you need to ensure that you have the BIOS up-to-date as to not have issues with UEFI or any other component.  Use these SQL statements to create your BIOS reports.


I am only trying to look at Workstation models and not servers.  HP was my second set of queries and it was easier to simply exclude the server models.  Use and modify as necessary.


HP
SELECT CompSys.Manufacturer0 as 'OEM', CompSys.model0 as 'Model',BIOS.SMBIOSBIOSVERSION0 as 'BIOSVersion', COUNT(Sys.Resourceid) AS 'TotalSystems'
 FROM V_R_System as Sys
 LEFT JOIN V_GS_PC_BIOS as BIOS on Sys.resourceid = BIOS.resourceid
 LEFT JOIN V_GS_COMPUTER_SYSTEM as CompSys on Sys.resourceid = CompSys.resourceid
 WHERE
 (CompSys.Manufacturer0 LIKE '%HP%'OR
  CompSys.Manufacturer0 LIKE '%Hewlett-Packard%') AND
 CompSys.model0 NOT like '%ProLiant%'
 GROUP BY CompSys.Manufacturer0,CompSys.model0, BIOS.SMBIOSBIOSVersion0
 ORDER BY CompSys.Model0, BIOS.SMBIOSBIOSVersion0




Dell
SELECT CompSys.Manufacturer0 as 'OEM', CompSys.model0 as 'Model',BIOS.SMBIOSBIOSVERSION0 as 'BIOSVersion', COUNT(Sys.Resourceid) AS 'TotalSystems'
 FROM V_R_System as Sys
 LEFT JOIN V_GS_PC_BIOS as BIOS on Sys.resourceid = BIOS.resourceid
 LEFT JOIN V_GS_COMPUTER_SYSTEM as CompSys on Sys.resourceid = CompSys.resourceid
 WHERE
 CompSys.Manufacturer0 LIKE '%dell%'
 AND (CompSys.Model0 LIKE '%optiplex%'
 OR CompSys.Model0 LIKE '%latitude%'
 OR CompSys.Model0 LIKE '%precision%')
 GROUP BY CompSys.Manufacturer0,CompSys.model0, BIOS.SMBIOSBIOSVersion0
 ORDER BY CompSys.Model0, BIOS.SMBIOSBIOSVersion0