Why does Group Policy block to create ISensorManger instance?Group policy doesn't let me execute ChromeHow...

Do I really need to have a scientific explanation for my premise?

Are all players supposed to be able to see each others' character sheets?

Why does the negative sign arise in this thermodynamic relation?

UART pins to unpowered MCU?

How can The Temple of Elementary Evil reliably protect itself against kinetic bombardment?

How to draw cubes in a 3 dimensional plane

How is the wildcard * interpreted as a command?

Definition of Statistic

Examples of a statistic that is not independent of sample's distribution?

Do f-stop and exposure time perfectly cancel?

List elements digit difference sort

Distinction between apt-cache and dpkg -l

How did Alan Turing break the enigma code using the hint given by the lady in the bar?

Declaring and defining template, and specialising them

What Happens when Passenger Refuses to Fly Boeing 737 Max?

Signed and unsigned numbers

How many characters using PHB rules does it take to be able to have access to any PHB spell at the start of an adventuring day?

Hotkey (or other quick way) to insert a keyframe for only one component of a vector-valued property?

Why does liquid water form when we exhale on a mirror?

Single word request: Harming the benefactor

Am I not good enough for you?

Accountant/ lawyer will not return my call

What problems would a superhuman have whose skin is constantly hot?

Reverse string, can I make it faster?



Why does Group Policy block to create ISensorManger instance?


Group policy doesn't let me execute ChromeHow can the specific Group Policy setting which triggers an error in an application be discovered?Group Policy Editor restricting my administrator account?Suddenly started to get a Couldn't connect to the Group Policy Client service. Why?Local group policy for all usersFind out what does change the settings for User Account Control all the timeHow do I specify advanced power settings for all users using group policy?Is there any way to control “Device Installation Restrictions” via the Registry (instead of Group Policy) for users on Windows Home Editions?Ex-Company Group Policy not enabling me to do Windows updatesHow to turn off a sign-in request on wake up













1















I have a Surface Pro 3, running Window 10 Pro, version 1803. One of the things that I do with this tablet is play around with the new API and programming features that Microsoft provides.



Recently, I was test some small toy programs using the sensor API to get a feel for them. I have a small program that enumerates all the sensors on the device, worked find on an older surface tablet, running 8.1. However when I brought the source code over to the Surface Pro, recompiled it and when to run it I got the error:



"Unable to CoCreateInstance() on SensorManger
error: This program is blocked by group policy. For more information contact your system administrator"



I get this error regardless if I run as myself or as an administrator. Due to this being test code, I never bother to do anything robust error handling so this error does not cause the program to abort, so the program continues and shows a GUI with no sensor discovered obviously.



This device is a personal stand-alone device, not attached to a domain controller. Under developers, I have selected "sideload apps".



My question is, how do I troubleshoot / fix the above error?



A second, related, question with this being a stand-alone computer do I really need Group Policy, and if not is there some way to disable it



Thanks










share|improve this question















migrated from serverfault.com yesterday


This question came from our site for system and network administrators.



















  • I googled that error message, and literally every site told me the first thing to look for is a virus/malware infection. You should do that first. After that, do the search yourself and go through the other dozen or so possibilities. If you exhaust all of those, go back to your program and add debugging code.

    – Michael Hampton
    yesterday











  • @Biswapriyo Yes, I have the code (I wrote it - it is my first attempt at using the new sensor API). As I mentioned in my original question, the code works correctly on a Windows 8.1 system listing the available sensors. It, however fails with the reported error on a Windows 10 system

    – thurizas
    17 hours ago











  • @Biswapriyo I'm hoping you will post the solution. (or if you have I'm not seeing it for some reason)

    – thurizas
    14 hours ago
















1















I have a Surface Pro 3, running Window 10 Pro, version 1803. One of the things that I do with this tablet is play around with the new API and programming features that Microsoft provides.



Recently, I was test some small toy programs using the sensor API to get a feel for them. I have a small program that enumerates all the sensors on the device, worked find on an older surface tablet, running 8.1. However when I brought the source code over to the Surface Pro, recompiled it and when to run it I got the error:



"Unable to CoCreateInstance() on SensorManger
error: This program is blocked by group policy. For more information contact your system administrator"



I get this error regardless if I run as myself or as an administrator. Due to this being test code, I never bother to do anything robust error handling so this error does not cause the program to abort, so the program continues and shows a GUI with no sensor discovered obviously.



This device is a personal stand-alone device, not attached to a domain controller. Under developers, I have selected "sideload apps".



My question is, how do I troubleshoot / fix the above error?



A second, related, question with this being a stand-alone computer do I really need Group Policy, and if not is there some way to disable it



Thanks










share|improve this question















migrated from serverfault.com yesterday


This question came from our site for system and network administrators.



















  • I googled that error message, and literally every site told me the first thing to look for is a virus/malware infection. You should do that first. After that, do the search yourself and go through the other dozen or so possibilities. If you exhaust all of those, go back to your program and add debugging code.

    – Michael Hampton
    yesterday











  • @Biswapriyo Yes, I have the code (I wrote it - it is my first attempt at using the new sensor API). As I mentioned in my original question, the code works correctly on a Windows 8.1 system listing the available sensors. It, however fails with the reported error on a Windows 10 system

    – thurizas
    17 hours ago











  • @Biswapriyo I'm hoping you will post the solution. (or if you have I'm not seeing it for some reason)

    – thurizas
    14 hours ago














1












1








1








I have a Surface Pro 3, running Window 10 Pro, version 1803. One of the things that I do with this tablet is play around with the new API and programming features that Microsoft provides.



Recently, I was test some small toy programs using the sensor API to get a feel for them. I have a small program that enumerates all the sensors on the device, worked find on an older surface tablet, running 8.1. However when I brought the source code over to the Surface Pro, recompiled it and when to run it I got the error:



"Unable to CoCreateInstance() on SensorManger
error: This program is blocked by group policy. For more information contact your system administrator"



I get this error regardless if I run as myself or as an administrator. Due to this being test code, I never bother to do anything robust error handling so this error does not cause the program to abort, so the program continues and shows a GUI with no sensor discovered obviously.



This device is a personal stand-alone device, not attached to a domain controller. Under developers, I have selected "sideload apps".



My question is, how do I troubleshoot / fix the above error?



A second, related, question with this being a stand-alone computer do I really need Group Policy, and if not is there some way to disable it



Thanks










share|improve this question
















I have a Surface Pro 3, running Window 10 Pro, version 1803. One of the things that I do with this tablet is play around with the new API and programming features that Microsoft provides.



Recently, I was test some small toy programs using the sensor API to get a feel for them. I have a small program that enumerates all the sensors on the device, worked find on an older surface tablet, running 8.1. However when I brought the source code over to the Surface Pro, recompiled it and when to run it I got the error:



"Unable to CoCreateInstance() on SensorManger
error: This program is blocked by group policy. For more information contact your system administrator"



I get this error regardless if I run as myself or as an administrator. Due to this being test code, I never bother to do anything robust error handling so this error does not cause the program to abort, so the program continues and shows a GUI with no sensor discovered obviously.



This device is a personal stand-alone device, not attached to a domain controller. Under developers, I have selected "sideload apps".



My question is, how do I troubleshoot / fix the above error?



A second, related, question with this being a stand-alone computer do I really need Group Policy, and if not is there some way to disable it



Thanks







windows-10 windows-registry group-policy com






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 12 mins ago









Biswapriyo

3,10141344




3,10141344










asked yesterday









thurizasthurizas

1082




1082




migrated from serverfault.com yesterday


This question came from our site for system and network administrators.









migrated from serverfault.com yesterday


This question came from our site for system and network administrators.















  • I googled that error message, and literally every site told me the first thing to look for is a virus/malware infection. You should do that first. After that, do the search yourself and go through the other dozen or so possibilities. If you exhaust all of those, go back to your program and add debugging code.

    – Michael Hampton
    yesterday











  • @Biswapriyo Yes, I have the code (I wrote it - it is my first attempt at using the new sensor API). As I mentioned in my original question, the code works correctly on a Windows 8.1 system listing the available sensors. It, however fails with the reported error on a Windows 10 system

    – thurizas
    17 hours ago











  • @Biswapriyo I'm hoping you will post the solution. (or if you have I'm not seeing it for some reason)

    – thurizas
    14 hours ago



















  • I googled that error message, and literally every site told me the first thing to look for is a virus/malware infection. You should do that first. After that, do the search yourself and go through the other dozen or so possibilities. If you exhaust all of those, go back to your program and add debugging code.

    – Michael Hampton
    yesterday











  • @Biswapriyo Yes, I have the code (I wrote it - it is my first attempt at using the new sensor API). As I mentioned in my original question, the code works correctly on a Windows 8.1 system listing the available sensors. It, however fails with the reported error on a Windows 10 system

    – thurizas
    17 hours ago











  • @Biswapriyo I'm hoping you will post the solution. (or if you have I'm not seeing it for some reason)

    – thurizas
    14 hours ago

















I googled that error message, and literally every site told me the first thing to look for is a virus/malware infection. You should do that first. After that, do the search yourself and go through the other dozen or so possibilities. If you exhaust all of those, go back to your program and add debugging code.

– Michael Hampton
yesterday





I googled that error message, and literally every site told me the first thing to look for is a virus/malware infection. You should do that first. After that, do the search yourself and go through the other dozen or so possibilities. If you exhaust all of those, go back to your program and add debugging code.

– Michael Hampton
yesterday













@Biswapriyo Yes, I have the code (I wrote it - it is my first attempt at using the new sensor API). As I mentioned in my original question, the code works correctly on a Windows 8.1 system listing the available sensors. It, however fails with the reported error on a Windows 10 system

– thurizas
17 hours ago





@Biswapriyo Yes, I have the code (I wrote it - it is my first attempt at using the new sensor API). As I mentioned in my original question, the code works correctly on a Windows 8.1 system listing the available sensors. It, however fails with the reported error on a Windows 10 system

– thurizas
17 hours ago













@Biswapriyo I'm hoping you will post the solution. (or if you have I'm not seeing it for some reason)

– thurizas
14 hours ago





@Biswapriyo I'm hoping you will post the solution. (or if you have I'm not seeing it for some reason)

– thurizas
14 hours ago










1 Answer
1






active

oldest

votes


















0















How do I troubleshoot / fix the above error?




Short answer: Run these two command as administrator (using reg add command):



REG ADD "HKLMSOFTWAREPoliciesMicrosoftWindowsLocationAndSensors" /V "DisableSensors" /T REG_DWORD /D "0" /F 
REG ADD "HKCUSOFTWAREPoliciesMicrosoftWindowsLocationAndSensors" /V "DisableSensors" /T REG_DWORD /D "0" /F




Explanation: I used some C language with SensorManger interface. You can skip this part. A demo program:



#include <Windows.h>
#include <sensorsapi.h>

void func(void)
{
HRESULT hRes = 0;
ISensorManager *pSensorManager = NULL;

hRes = CoInitialize(NULL);
hRes = CoCreateInstance(&CLSID_SensorManager,
NULL,
CLSCTX_INPROC_SERVER,
&IID_ISensorManager,
&pSensorManager);

hRes = pSensorManager->lpVtbl->Release(pSensorManager);
CoUninitialize();
}




How did I find? This requires some reverse engineering idea. The CLSID_SensorManager GUID leads me to C:WindowsSystem32SensorsApi.dll file. I opened it in a disassembler. There is a function SensorsGroupPolicy::IsSensorsFeatureDisabled in that DLL file which checks both the two REG_DWORD values.





  • HKLMSOFTWAREPoliciesMicrosoftWindowsLocationAndSensorsDisableSensors is checked first which is applied for all user.

  • Then HKCUSOFTWAREPoliciesMicrosoftWindowsLocationAndSensorsDisableSensors is checked which is applied for current logged in user.

  • The setting can be disabled in Local Group Policy editor → Computer Configuration → Administrative Templates → Windows Components → Location and Sensors → Turn off sensors → Disabled. But the registry method is instantaneous.






share|improve this answer
























  • thanks alot. The only issue was that i kept getting a syntax error on the REG ADD commands. Finally just added the keys/ values manually.

    – thurizas
    4 hours ago











  • Interesting, the commands work fine in my PC.

    – Biswapriyo
    15 mins ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1412957%2fwhy-does-group-policy-block-to-create-isensormanger-instance%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0















How do I troubleshoot / fix the above error?




Short answer: Run these two command as administrator (using reg add command):



REG ADD "HKLMSOFTWAREPoliciesMicrosoftWindowsLocationAndSensors" /V "DisableSensors" /T REG_DWORD /D "0" /F 
REG ADD "HKCUSOFTWAREPoliciesMicrosoftWindowsLocationAndSensors" /V "DisableSensors" /T REG_DWORD /D "0" /F




Explanation: I used some C language with SensorManger interface. You can skip this part. A demo program:



#include <Windows.h>
#include <sensorsapi.h>

void func(void)
{
HRESULT hRes = 0;
ISensorManager *pSensorManager = NULL;

hRes = CoInitialize(NULL);
hRes = CoCreateInstance(&CLSID_SensorManager,
NULL,
CLSCTX_INPROC_SERVER,
&IID_ISensorManager,
&pSensorManager);

hRes = pSensorManager->lpVtbl->Release(pSensorManager);
CoUninitialize();
}




How did I find? This requires some reverse engineering idea. The CLSID_SensorManager GUID leads me to C:WindowsSystem32SensorsApi.dll file. I opened it in a disassembler. There is a function SensorsGroupPolicy::IsSensorsFeatureDisabled in that DLL file which checks both the two REG_DWORD values.





  • HKLMSOFTWAREPoliciesMicrosoftWindowsLocationAndSensorsDisableSensors is checked first which is applied for all user.

  • Then HKCUSOFTWAREPoliciesMicrosoftWindowsLocationAndSensorsDisableSensors is checked which is applied for current logged in user.

  • The setting can be disabled in Local Group Policy editor → Computer Configuration → Administrative Templates → Windows Components → Location and Sensors → Turn off sensors → Disabled. But the registry method is instantaneous.






share|improve this answer
























  • thanks alot. The only issue was that i kept getting a syntax error on the REG ADD commands. Finally just added the keys/ values manually.

    – thurizas
    4 hours ago











  • Interesting, the commands work fine in my PC.

    – Biswapriyo
    15 mins ago
















0















How do I troubleshoot / fix the above error?




Short answer: Run these two command as administrator (using reg add command):



REG ADD "HKLMSOFTWAREPoliciesMicrosoftWindowsLocationAndSensors" /V "DisableSensors" /T REG_DWORD /D "0" /F 
REG ADD "HKCUSOFTWAREPoliciesMicrosoftWindowsLocationAndSensors" /V "DisableSensors" /T REG_DWORD /D "0" /F




Explanation: I used some C language with SensorManger interface. You can skip this part. A demo program:



#include <Windows.h>
#include <sensorsapi.h>

void func(void)
{
HRESULT hRes = 0;
ISensorManager *pSensorManager = NULL;

hRes = CoInitialize(NULL);
hRes = CoCreateInstance(&CLSID_SensorManager,
NULL,
CLSCTX_INPROC_SERVER,
&IID_ISensorManager,
&pSensorManager);

hRes = pSensorManager->lpVtbl->Release(pSensorManager);
CoUninitialize();
}




How did I find? This requires some reverse engineering idea. The CLSID_SensorManager GUID leads me to C:WindowsSystem32SensorsApi.dll file. I opened it in a disassembler. There is a function SensorsGroupPolicy::IsSensorsFeatureDisabled in that DLL file which checks both the two REG_DWORD values.





  • HKLMSOFTWAREPoliciesMicrosoftWindowsLocationAndSensorsDisableSensors is checked first which is applied for all user.

  • Then HKCUSOFTWAREPoliciesMicrosoftWindowsLocationAndSensorsDisableSensors is checked which is applied for current logged in user.

  • The setting can be disabled in Local Group Policy editor → Computer Configuration → Administrative Templates → Windows Components → Location and Sensors → Turn off sensors → Disabled. But the registry method is instantaneous.






share|improve this answer
























  • thanks alot. The only issue was that i kept getting a syntax error on the REG ADD commands. Finally just added the keys/ values manually.

    – thurizas
    4 hours ago











  • Interesting, the commands work fine in my PC.

    – Biswapriyo
    15 mins ago














0












0








0








How do I troubleshoot / fix the above error?




Short answer: Run these two command as administrator (using reg add command):



REG ADD "HKLMSOFTWAREPoliciesMicrosoftWindowsLocationAndSensors" /V "DisableSensors" /T REG_DWORD /D "0" /F 
REG ADD "HKCUSOFTWAREPoliciesMicrosoftWindowsLocationAndSensors" /V "DisableSensors" /T REG_DWORD /D "0" /F




Explanation: I used some C language with SensorManger interface. You can skip this part. A demo program:



#include <Windows.h>
#include <sensorsapi.h>

void func(void)
{
HRESULT hRes = 0;
ISensorManager *pSensorManager = NULL;

hRes = CoInitialize(NULL);
hRes = CoCreateInstance(&CLSID_SensorManager,
NULL,
CLSCTX_INPROC_SERVER,
&IID_ISensorManager,
&pSensorManager);

hRes = pSensorManager->lpVtbl->Release(pSensorManager);
CoUninitialize();
}




How did I find? This requires some reverse engineering idea. The CLSID_SensorManager GUID leads me to C:WindowsSystem32SensorsApi.dll file. I opened it in a disassembler. There is a function SensorsGroupPolicy::IsSensorsFeatureDisabled in that DLL file which checks both the two REG_DWORD values.





  • HKLMSOFTWAREPoliciesMicrosoftWindowsLocationAndSensorsDisableSensors is checked first which is applied for all user.

  • Then HKCUSOFTWAREPoliciesMicrosoftWindowsLocationAndSensorsDisableSensors is checked which is applied for current logged in user.

  • The setting can be disabled in Local Group Policy editor → Computer Configuration → Administrative Templates → Windows Components → Location and Sensors → Turn off sensors → Disabled. But the registry method is instantaneous.






share|improve this answer














How do I troubleshoot / fix the above error?




Short answer: Run these two command as administrator (using reg add command):



REG ADD "HKLMSOFTWAREPoliciesMicrosoftWindowsLocationAndSensors" /V "DisableSensors" /T REG_DWORD /D "0" /F 
REG ADD "HKCUSOFTWAREPoliciesMicrosoftWindowsLocationAndSensors" /V "DisableSensors" /T REG_DWORD /D "0" /F




Explanation: I used some C language with SensorManger interface. You can skip this part. A demo program:



#include <Windows.h>
#include <sensorsapi.h>

void func(void)
{
HRESULT hRes = 0;
ISensorManager *pSensorManager = NULL;

hRes = CoInitialize(NULL);
hRes = CoCreateInstance(&CLSID_SensorManager,
NULL,
CLSCTX_INPROC_SERVER,
&IID_ISensorManager,
&pSensorManager);

hRes = pSensorManager->lpVtbl->Release(pSensorManager);
CoUninitialize();
}




How did I find? This requires some reverse engineering idea. The CLSID_SensorManager GUID leads me to C:WindowsSystem32SensorsApi.dll file. I opened it in a disassembler. There is a function SensorsGroupPolicy::IsSensorsFeatureDisabled in that DLL file which checks both the two REG_DWORD values.





  • HKLMSOFTWAREPoliciesMicrosoftWindowsLocationAndSensorsDisableSensors is checked first which is applied for all user.

  • Then HKCUSOFTWAREPoliciesMicrosoftWindowsLocationAndSensorsDisableSensors is checked which is applied for current logged in user.

  • The setting can be disabled in Local Group Policy editor → Computer Configuration → Administrative Templates → Windows Components → Location and Sensors → Turn off sensors → Disabled. But the registry method is instantaneous.







share|improve this answer












share|improve this answer



share|improve this answer










answered 13 hours ago









BiswapriyoBiswapriyo

3,10141344




3,10141344













  • thanks alot. The only issue was that i kept getting a syntax error on the REG ADD commands. Finally just added the keys/ values manually.

    – thurizas
    4 hours ago











  • Interesting, the commands work fine in my PC.

    – Biswapriyo
    15 mins ago



















  • thanks alot. The only issue was that i kept getting a syntax error on the REG ADD commands. Finally just added the keys/ values manually.

    – thurizas
    4 hours ago











  • Interesting, the commands work fine in my PC.

    – Biswapriyo
    15 mins ago

















thanks alot. The only issue was that i kept getting a syntax error on the REG ADD commands. Finally just added the keys/ values manually.

– thurizas
4 hours ago





thanks alot. The only issue was that i kept getting a syntax error on the REG ADD commands. Finally just added the keys/ values manually.

– thurizas
4 hours ago













Interesting, the commands work fine in my PC.

– Biswapriyo
15 mins ago





Interesting, the commands work fine in my PC.

– Biswapriyo
15 mins ago


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1412957%2fwhy-does-group-policy-block-to-create-isensormanger-instance%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...