This blog post deals with adding fake computers or users to a SCCM environment.
Why would you want to add fake clients to a SCCM environment?
You probably want to test something, maybe load test something, there can be multiple reasons.
But since you are here, you probably have a reason, so let's move on
I use the CM Client API to create a resource and I say resource because it can also be a user in addition to a computer.
So, let's start with the prerequisites so you don't waste your time here.
Configuration Manager Client Messaging SDK
From here, you actually only need the file 'Microsoft.ConfigurationManagement.Messaging.dll'
Configuration Manager PowerShell module
(Not required when using CmDeviceSeed.exe)
You need to be a full admin on SCCM - you know what that is.
We will create a certificate that we will have to import into SCCM.
CmDeviceSeed.exe requires at least .NET Framework 4.5.
First of all, we need to add a SCCM ISV Proxy Certificate.
That is a selfsigned certificate that we need to import into SCCM in order to create multiple resources.
If we don't have that certificate, each time we add a resource, it will just overwrite the existing. Not much load testing it that, huh?
I always run my device seeder on the SCCM server, but guess you can do that from any machine.
Anyway, create the certificate on the machine you want to run the seeder scripts from.
Run the following PowerShell command to create a self-signed certificate:
New-SelfSignedCertificate -Type Custom -Subject "CN=CmDeviceSeed ISV Proxy Certificate" -KeyLength 2048 -KeySpec KeyExchange -KeyExportPolicy Exportable -FriendlyName "CmDeviceSeed ISV Proxy Certificate" -CertStoreLocation "cert:\LocalMachine\My"
This will place the certificate in the Machine part of the certicate store.
So open the certificate snap-in (Manager Computer Certicates), expand Personal and find the certificate we just generated.
We need to export that to a .cer file:
Export without exporting the private key:
Select to export to a .cer file. Here, I selected the DER encoding, but Base-64 would probably work too:
So, let's finalize this:
Now we need to import that certificate into SCCM.
Open the Console and select the Administration workspace, navigate to Security -> Certificates.
From here, select Register or Renew ISV Proxy, select Register and locate the .cer file we just exported:
You should see that in the list as the type "ISV Proxy"
Did that work? If it did, we are so ready to create some devices!
Create basic computers
We want to see if we can add more than one computer in SCCM, so try that with a little help from the SCCM PowerShell Module.
Also, make sure you know where you put the file 'Microsoft.ConfigurationManagement.Messaging.dll' cause we need that now.
Do you know the site code of your ConfigMgr environment?
I hope you do or you shouldn't be doing this
Anyway, nobody is perfect, so if in doubt, find it under the Site Configuration -> Sites:
Got it? Great. Use this for the following PowerShell script along with the paths to the PowerShell Module and the Client Messaging SDK dll file:
Oh, explaination. Right.
So in the top of the script, I specified the Site Code and that I want to create 10 computers. The script has a numbering function, so I just specify what number to start with, 1 in this case.
Then the prefix of the computers, here 'WS', so the first should be named WS000001 and so on.
Then the path to the .dll and .psd1 files and we are done with the custom part.
You will notice two functions; one for creating a random MAC Address and one for creating the actual computer in SCCM.
We will skip the MAC function, the CreateDDREntry function is more fun.
You can set the Agent Name, it's up to you what to call it. It will be added along the DDR entry.
Architecture is system for a computer.
Then comes the MAC Address some integer properties letting us decide if the computer should act as active and have an agent.
Of cause this is all fake, but still great!
Then we add the Operating System, here 6.3 means Windows 8.1 (yeah, it's been a while since I created this script)
Feel free to create any OS you want
Did you run it? Sure you did!
Then you will see 10 new very fake devices in the console:
Awesome! You did it.
Want more? How about adding users?
Create users
Absolutely, here is a script for that, just creating some rnadom names:
You will notice I commented the New-ADUser out.
If you want (and have permissions) you can add the users to Active Directory too, but do remember to generate a complex password.
But where is the Hardware Inventory part the title promised.
I created a small console utility to push a hardware inventory file to the CM Management Point.
(Why not a PowerShell script? Simple. I am better with C# than with PowerShell, why I created the tool, but I'm sure it can be done with PowerShell too.)
Adding a computer with full hardware inventory
For this you will need to generate a hardware inventory file.
On a computer that has (a real) SCCM Agent open C:\Windows\CCM\Inventory\Temp
Look for the largest xml file.
None there?
Add an empty file named Archives_reports.sms in the folder and force a hardware inventory rerun. Then it should appear.
Open the xml file and verify it is a Hardware Inventory report.
Look for the InventoryAction section, the Description must say Hardware:
Now, copy that xml file to the folder where the file CmDeviceSeed.exe resides. Rename it to 'hwi_template.xml'
Also in that same folder make sure you have the file 'Microsoft.ConfigurationManagement.Messaging.dll'
Open a command prompt and run this command to create a computer and have it upload the hardware inventory:
CmDeviceSeed.exe CT1 -n WS000100 -invfile hwi_template.xml
The tool should output something like this:
Heading over to the console, you will see the computer, but unfortunately there is no hardware inventory
Why is that, didn't it send it?? Well, yes, but it is the hardware inventory for that other client we just copied it from, so SCCM doesn't accept it.
Hmm, then we will have to open that xml file, search and replace the device name with the one we want to create. But that is how it is.
We can do that with a PowerShell script:
So the script replaces the device name with our fake device name, creates a xml file and uploads that along the DDR.
With some luck you should be able to see hardware inventory in the console:
Now that we have the script to create a device, we can just extend that script to create a many devices as we want.
The CmDeviceSeeder util will make sure all fake devices will get a unique hardware id:
We completed the blog, you can now add fake devices with hardware inventory to do your testing.
Wanna do more customization?
Suppose you want to have unique hardware inventory?
Just manipulate the "template" xml file.
Say we want to add some common inventory like manufacturer, model, serialnumber, etc.
Let's add a function to our script that can locate and replace as we want:
Here we faked the computer to become a Windows 2019 Enterprise server running on VMWare.
But you can add more Disks, Memory, CPU, etc if you want:
Last thing I wanna add is how to create a User/Device Affinity relation.
We will just add this directly into SCCM using WMI, so different for the above:
I hope you liked this rather long post.
Download:
CmDeviceSeed
Who am I?
My name is Flemming Appelon Christiansen.
I am a developer at CTGlobal and have a long history with developing tools and apps for Configuration Manager and other management systems.
Currently very focused on our product Insight Analytics that you owe yourself to have a look at.
My experience comes out of interest and curiosity, probably just like yours