OfficeDocs-Support icon indicating copy to clipboard operation
OfficeDocs-Support copied to clipboard

OLicenseCleanup.vbs run with elevated privileges.

Open BoxOfPain opened this issue 4 years ago • 2 comments

Hi! Sorry for the noob question, but how to run OLicenseCleanup.vbs with elevated privileges? I just can't find simple way to do that.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

BoxOfPain avatar Jun 07 '21 10:06 BoxOfPain

No worries, have you looked at Active Setup? You could use a run once option?

We set two registry keys and push them out via Group Policy. The key is placed under here:

HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components{00004321-4321-4321-4321-000000004321}

{00004321-4321-4321-4321-000000004321} – is not a real GUID, we just need a place holder.

In that Key, we will have two string values: StubPath and Version

The values for these strings are: StubPath = the command to run the script, which must be available for all users to hit – C:\Windows\temp; \server\sharefile://server/share; etc. Version = needs to be a number separated by 3 commas 1,0,0,1 for example

Here is an example script to set up Active Setup:

$regPath = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components{00004321-4321-4321-4321-000000004321}" if(!(Test-Path $regPath)){New-Item -Path $regPath -Force}

New-ItemProperty -Path $regPath -Name 'StubPath' -Value "cscript.exe c:\Windows\Temp\OSPPClean_O16_All.vbs" New-ItemProperty -Path $regPath -Name 'Version' -Value '1,0,0,1'

Now whenever a user logs in, the OSPPClean script will run one time for them

Keep in mind there are other options as well. The above is just an example.

Matt Philipenko Sr. Customer Engineer – Microsoft 365 Apps Ranger Microsoft 365 Apps <Deployment/Servicing/Activation/> 10 Habits to create accessible contenthttps://blogs.microsoft.com/accessibility/10-habits-to-create-accessible-content/

From: BoxOfPain @.> Sent: Monday, June 7, 2021 6:27 AM To: MicrosoftDocs/OfficeDocs-Support @.> Cc: Matt Philipenko (OFFICE RANGER) @.>; Mention @.> Subject: [MicrosoftDocs/OfficeDocs-Support] OLicenseCleanup.vbs run with elevated privileges. (#1544)

Hi! Sorry for the noob question, but how to run OLicenseCleanup.vbs with elevated privileges? I just can't find simple way to do that.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2FOfficeDocs-Support%2Fissues%2F1544&data=04%7C01%7Cmattphil%40microsoft.com%7Cc6391e9e6b524c7cf87308d9299ec954%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637586584225610628%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=f9Ck8SXzGXaK1KDH6qCNmamhZfxIhiEVDOuK%2FCk%2Fyh4%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALV2LTVNBGQTYDFVSD3WX2LTRSNHJANCNFSM46HLLZUQ&data=04%7C01%7Cmattphil%40microsoft.com%7Cc6391e9e6b524c7cf87308d9299ec954%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637586584225620585%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wQ%2BeOpEyB0Db4b2QQUms80jI4je2UIQeZxR9o6TZhMg%3D&reserved=0.

MJP-MSFT avatar Jun 07 '21 13:06 MJP-MSFT

No worries, have you looked at Active Setup? You could use a run once option? We set two registry keys and push them out via Group Policy. The key is placed under here: HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components{00004321-4321-4321-4321-000000004321} {00004321-4321-4321-4321-000000004321} – is not a real GUID, we just need a place holder. In that Key, we will have two string values: StubPath and Version The values for these strings are: StubPath = the command to run the script, which must be available for all users to hit – C:\Windows\temp; \server\sharefile://server/share; etc. Version = needs to be a number separated by 3 commas 1,0,0,1 for example Here is an example script to set up Active Setup: $regPath = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components{00004321-4321-4321-4321-000000004321}" if(!(Test-Path $regPath)){New-Item -Path $regPath -Force} New-ItemProperty -Path $regPath -Name 'StubPath' -Value "cscript.exe c:\Windows\Temp\OSPPClean_O16_All.vbs" New-ItemProperty -Path $regPath -Name 'Version' -Value '1,0,0,1' Now whenever a user logs in, the OSPPClean script will run one time for them Keep in mind there are other options as well. The above is just an example. Matt Philipenko Sr. Customer Engineer – Microsoft 365 Apps Ranger Microsoft 365 Apps <Deployment/Servicing/Activation/> 10 Habits to create accessible contenthttps://blogs.microsoft.com/accessibility/10-habits-to-create-accessible-content/ From: BoxOfPain @.> Sent: Monday, June 7, 2021 6:27 AM To: MicrosoftDocs/OfficeDocs-Support @.> Cc: Matt Philipenko (OFFICE RANGER) @.>; Mention @.> Subject: [MicrosoftDocs/OfficeDocs-Support] OLicenseCleanup.vbs run with elevated privileges. (#1544) Hi! Sorry for the noob question, but how to run OLicenseCleanup.vbs with elevated privileges? I just can't find simple way to do that. ________________________________ Document Details ⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking. * ID: e1375a9d-fa30-75a2-5aea-daca0e74f142 * Version Independent ID: c9510807-f261-5a24-0039-d6bf5ad630e5 * Content: Reset Microsoft 365 Apps for enterprise activation state - Officehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice%2Ftroubleshoot%2Factivation%2Freset-office-365-proplus-activation-state&data=04%7C01%7Cmattphil%40microsoft.com%7Cc6391e9e6b524c7cf87308d9299ec954%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637586584225600671%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=nm7wEI1pwVSwp9b7MCdJ6sDnNCW8G%2Fv26rw09WYV1aM%3D&reserved=0 * Content Source: Office/OfficeExperts/activation/reset-office-365-proplus-activation-state.mdhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2FOfficeDocs-Support%2Fblob%2Fpublic%2FOffice%2FOfficeExperts%2Factivation%2Freset-office-365-proplus-activation-state.md&data=04%7C01%7Cmattphil%40microsoft.com%7Cc6391e9e6b524c7cf87308d9299ec954%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637586584225600671%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=LCFt%2FgvJu%2BS8Q0gjS3sJjK0%2FHv%2F7wHEw5ZFe3Ywaiwk%3D&reserved=0 * Service: o365-solutions * GitHub Login: @MJP-MSFThttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMJP-MSFT&data=04%7C01%7Cmattphil%40microsoft.com%7Cc6391e9e6b524c7cf87308d9299ec954%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637586584225610628%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ZdnPSlFwt%2FRPPwebK%2FEkrMkn4fmYh%2Fvsd0GcPHQIYCQ%3D&reserved=0 * Microsoft Alias: mattphil — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2FOfficeDocs-Support%2Fissues%2F1544&data=04%7C01%7Cmattphil%40microsoft.com%7Cc6391e9e6b524c7cf87308d9299ec954%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637586584225610628%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=f9Ck8SXzGXaK1KDH6qCNmamhZfxIhiEVDOuK%2FCk%2Fyh4%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALV2LTVNBGQTYDFVSD3WX2LTRSNHJANCNFSM46HLLZUQ&data=04%7C01%7Cmattphil%40microsoft.com%7Cc6391e9e6b524c7cf87308d9299ec954%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637586584225620585%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wQ%2BeOpEyB0Db4b2QQUms80jI4je2UIQeZxR9o6TZhMg%3D&reserved=0.

Hi! thank you for the reply. I need this script maybe twice a year, so I'm thinking that GP is too overpowered for it. I'm looking for local solution, when I have only users pc and admin account, for example.

BoxOfPain avatar Jun 07 '21 14:06 BoxOfPain