![Pro-Tips-with-Esben-35-User-Profile-Size](https://cdn-website.lansweeper.com/wp-content/uploads/Pro-Tips-with-Esben-35-User-Profile-Size.png)
Pro Tips with Esben #35
This week we aim to inventory user profile sizes to get an overview of the sizes of user profiles in your IT environment.
Old profiles can start bloating up computers easily and take up unnecessary space, a problem that certain industries like education are all too familiar with. Having public devices that are used by a large number of unique users that log in and leave user-profiles behind can easily start filling the device’s storage.
Storing the Data in the Registry
To fetch the data and get it into Lansweeper, we’ll need to first store it in a location Lansweeper can scan it from. The easiest method is to store it in registry keys. I’ve created a Powershell script that grabs the User Profile name and the size of the folder and put it in registry keys.
You can download the PowerShell script here.
The script checks and creates the registry key HKEY_LOCAL_MACHINESYSTEMUserProfiles, after creating it, it will query a PowerShell function to grab the user profile folder names and their size. For each row that is retrieved, a new registry value is created, starting with the name 0 and counting upwards.
![User profiles registry keys](https://cdn-website.lansweeper.com/wp-content/uploads/regsitry-key-1024x352.png)
Deploying the PowerShell Script
Now that we have a script, it’s time to push this out to all Windows devices. You can do this with whatever your preferred method is (GPO, Intune, etc.) or use Lansweeper’s deployment which I’ll cover here briefly.
To deploy it with Lanswepeer, I’ve created a deployment package that you can use in combination with a report. You can find both of these resources on the deployment forum post. Please note that Windows 7 isn’t supported.
You can import the deployment package into your Lanswepeer installation and use the attached report as a target list. The report will contain all assets that do not have the registry keys scanned. Once the deployment is complete, Lansweeper will automatically rescan the asset and it will automatically be removed from the target list report. The PowerShell script itself needs to be placed in the Lansweeper Scripts folder (C:Program Files (x86)LansweeperPackageShareScripts).
![deployment package user profile example](https://cdn-website.lansweeper.com/wp-content/uploads/deployment-package-1024x579.png)
Scanning User Profile Size
Once the deployment is complete, you should have the data in the registry keys and all that is left to do is scan those. Add the registry keys to your registry scanning configuration. Depending on how many user profiles are on your devices, you’ll have to adjust how many registry values you scan. Remember, each user profile gets its own registry value!
![Registry key scanning user profile example](https://cdn-website.lansweeper.com/wp-content/uploads/2022/11/Registry-key-scanning.png)
Reporting
Finally, we get to view the data in Lansweeper. I’ve made an overview report that lists the first 15 registry keys’ data so you can view up to 15 user profiles’ data.
![user profile size report example](https://cdn-website.lansweeper.com/wp-content/uploads/user-profile-size-report-example-1024x155.png)