Jump to content


anyweb

Configuring the Registered Owner and Organization in Windows Autopilot delivered PCs

Recommended Posts

Introduction

I received a brand new HP Laptop (HP EliteBook 830 G6) to verify our current Autopilot setup, and I went through OOBE. All seemed well and I was curious about the version of Windows shipped so I ran WinVer. The following screen appeared.

winver.png

Notice how the registered owner and registered organization fields are automatically populated with HP's default settings, this was a Windows Autopilot enrolled HP delivered with HP's business clean image (no bloatware). The following registry key reveals where those values are set.

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion

registry settings.png

if the following REG_SZ keys are missing:

  • RegisteredOrganization
  • RegisteredOwner

You'd see the following instead.

values not set.png

So now that I knew why I was seeing those values I decided to fix it.

Step 1 - Add a PowerShell script to Endpoint Manager

In Microsoft Endpoint Manager select Devices and then select Scripts as shown here (alternatively, choose Devices, Windows, PowerShell Scripts...)

devices and scripts.png

Click on Add and select Windows 10 as the operating system.

add windows 10.png

 

Fill in the Name of the script and a description, note that the Name does not have to match the actual name of the script.

name and description of script.png

Note: you must be a logged in member of windows-noob.com to download this script.

Next, point it to the PowerShell script which you can download here and select to Run this script using the logged on credentials.

add powershell script.png

Next select the Groups you want to assign it to, I selected my Windows 10 Autopilot DEVICES group

windows  10 autopilot DEVICES group.png

Step 2. Test an Autopilot device

Start OOBE (out of box experience) on an Autopilot enrolled device.

autopilot oobe.png

move through the screens and you'll have to enter your credentials at the welcome to your Tenant name screen

welcome to technical preview.png

after signing in successfully the Enrollment Status Page will appear (if configured to do so)

ESP.png

Step 3. Verify changes

If everything went according to plan, after a while Windows Autopilot will be completed and you'll be logged on to the desktop, you can now verify the changes by typing WinVer.

winver fixed.png

Troubleshooting

If things didn't go as planned take a look at the IntuneManagementExtension.log with CMTrace. It's found in the C:\ProgramData\Microsoft\IntuneManagementExtention\Logs folder

 

image.png

and confirm that the script ran successfully and that it ran in User context (user was a local admin in this case). If you need to run it as SYSTEM then change the variable for RegisteredOwner in the script to something else.

job done !

Downloads

Here's the PowerShell script used above

ConfigureRegistered_User_Org.ps1

 

Share this post


Link to post
Share on other sites

If user is not local admin then we can use below command to set the value of $UserName and run as system context 

 

$UserName = (Get-ItemProperty (Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Enrollments" -Recurse -ErrorAction SilentlyContinue | % {if((get-itemproperty -Path $_.PsPath) -match "UPN") { $_.PsPath} }) -Name UPN | Select -ExpandProperty UPN).split('@')[0]

Share this post


Link to post
Share on other sites

Hello, 

I have implemented this script from Intune and disabled Run this Script using logged on credentials option and it is working as expected but I am getting $ behind username, can you please suggest here? 
Thanks in advance 

image.jpg

Share this post


Link to post
Share on other sites

That is normal when you deploy it in SYSTEM context, if you want to get something else change the variable for RegisteredOwner in the script to something else.

Share this post


Link to post
Share on other sites

here's the original code

<# 
Modify Registered user name/org name as shown in Winver
adds a reg key, run as logged on user...
niall brady 2020/08/06
#> 


# Add User name and Org name in the "this product is licensed under the Microsoft Software License Terms to: shown in WinVer
$UserName = $env:UserName
$OrgName = "windows-noob.com"
$path = 'HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion'

$key = try {
    Get-Item -Path $path -ErrorAction STOP
}
catch {
    #New-Item -Path $path -Force
}

New-ItemProperty -Path $key.PSPath -Name RegisteredOwner -Value $UserName -Force
New-ItemProperty -Path $key.PSPath -Name RegisteredOrganization -Value $OrgName -Force

change it like so...

 

<# 
Modify Registered user name/org name as shown in Winver
adds a reg key, run as logged on user...
niall brady 2020/08/06
#> 


# Add User name and Org name in the "this product is licensed under the Microsoft Software License Terms to: shown in WinVer
$UserName = $env:UserName
$OrgName = "windows-noob.com"
$path = 'HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion'

$key = try {
    Get-Item -Path $path -ErrorAction STOP
}
catch {
    #New-Item -Path $path -Force
}

# when running in SYSTEM context, $UserName will be returned as the Computer
# so Change RegisteredOwner to something else, such as your company name
$RegisteredOwner = "windows-noob.com"
New-ItemProperty -Path $key.PSPath -Name RegisteredOwner -Value $RegisteredOwner -Force
New-ItemProperty -Path $key.PSPath -Name RegisteredOrganization -Value $OrgName -Force

 

Share this post


Link to post
Share on other sites

20 hours ago, anyweb said:

here's the original code

<# 
Modify Registered user name/org name as shown in Winver
adds a reg key, run as logged on user...
niall brady 2020/08/06
#> 


# Add User name and Org name in the "this product is licensed under the Microsoft Software License Terms to: shown in WinVer
$UserName = $env:UserName
$OrgName = "windows-noob.com"
$path = 'HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion'

$key = try {
    Get-Item -Path $path -ErrorAction STOP
}
catch {
    #New-Item -Path $path -Force
}

New-ItemProperty -Path $key.PSPath -Name RegisteredOwner -Value $UserName -Force
New-ItemProperty -Path $key.PSPath -Name RegisteredOrganization -Value $OrgName -Force

change it like so...

 

<# 
Modify Registered user name/org name as shown in Winver
adds a reg key, run as logged on user...
niall brady 2020/08/06
#> 


# Add User name and Org name in the "this product is licensed under the Microsoft Software License Terms to: shown in WinVer
$UserName = $env:UserName
$OrgName = "windows-noob.com"
$path = 'HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion'

$key = try {
    Get-Item -Path $path -ErrorAction STOP
}
catch {
    #New-Item -Path $path -Force
}

# when running in SYSTEM context, $UserName will be returned as the Computer
# so Change RegisteredOwner to something else, such as your company name
$RegisteredOwner = "windows-noob.com"
New-ItemProperty -Path $key.PSPath -Name RegisteredOwner -Value $RegisteredOwner -Force
New-ItemProperty -Path $key.PSPath -Name RegisteredOrganization -Value $OrgName -Force

 

But I want it to retrieve the registered owner name from users device only, I will have to manually name the registered owner according to the script provided by you. But I need to apply it for multiple users and want to fetch their device username. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.