WMI GetObject Error - vbscript

On Windows XP, in my vbscript, I am using
GetObject("winmgmts:\.\root\cimv2")
to get WMI service object, but always get error: (null): Invalid syntax. I checked the syntax, it should be ok. I even tried to rebuild the Repo as suggested here , but still got the same error. I guess it might be permission/security policy issue. Any suggestions?

Your syntax is wrong you are missing a \
instead use
GetObject("winmgmts:\\.\root\cimv2");
or even better you can get the instance of the WMI class directly including the WMI path
GetObject("winmgmts:\\.\root\cimv2:Win32_LogicalDisk='C:'")

Related

"Restore operation failed due to invalid parameters or format of the parameters is not correct" from Restores.TriggerAsync

I am using Microsoft.Azure.Management.RecoveryServices.Backup 4.0.1 to restore Azure VM in C#, I received an error on Restores.TriggerAsync:
"Restore operation failed due to invalid parameters or format of the parameters is not correct"
I tried to find the documentation on how to set the parameters with RestoreRequestResource, I couldn't find anything. Can someone using Microsoft.Azure.Management.RecoveryServices.Backup, help me? Thank you.
After trial and error for a few days, finally I resolved the issue. For Restores.TriggerAsync API call, the paramter's Properites needs to be set to an IaasVMRestoreRequest instance, which will become the REST API call body.

WritePrivateProfileString produces ERROR_FILE_NOT_FOUND

My Software is writing to an ini file in c:\users...\documents and from time to time I get error reports from users where the WritePrivateProfileString call returns false and then GetLastError returns 2 (ERROR_FILE_NOT_FOUND).
I don't understand how this can happen and I wasn't able to reproduce it, since WritePrivateProfileString is supposed to create the file if it's missing.
If the directory didn't exist, the error would be ERROR_PATH_NOT_FOUND, if the file couldn't be created for permission reasons, it would be ERROR_ACCESS_DENIED.
So does anyone know why/when this function can produce this error? And how I can deal with it? As in: I rely on the file being created if necessary.
I think I may have found the answer myself.
The problem seems to occur when Windows Security -> Ransomware protection -> Controlled folder access is enabled and the application isn't white-listed.
ERROR_FILE_NOT_FOUND is a very confusing error message for this situation imho...

Sonar rest API insufficient privileges

I can't access most of the Sonar API, for example
localhost:9000/api/tests/show?key=htmlparser:/src/test/java/HtmlParserTest.java
or see api/sources/scm. api/server/system and some other general stuff works but nothing where I actually see the code.
I always get a
{"errors":[{"msg":"Insufficient privileges"}]}
I set the project permissions to let anyone see source code & browse the porject, I tried it with Postman, a Java HttpRequest, the command line ...
curl -u admin:admin localhost:9000/api/tests/show?key=htmlparser:/src/test/java/HtmlParserTest.java
I checked with SonarQube 5.1 and 4.5.1. I've found a posts with the same issue but have yet to find a fix. Does anyone have a solution idea?
Thanks for your help
SOLUTION
It was a syntax error (even though the message said Insufficient privileges). The correct call would be:
localhost:9000/api/tests/show?key=htmlparser:htmlparser:src/test/java/HtmlParserTest.java
If you are not sure what goes before the "src/..." don't worry. You can get it by calling api/projects/index and looking at the attribute named "k".

What is the GlobalIdentity and how do I set it in the FileNet web service?

I'm trying to upload a document into filenet via CEWS, but I'm getting this error:
“The unexpected exception is chained to this exception. Message was: com.filenet.apiimpl.core.GlobalIdentity incompatible with com.filenet.apiimpl.core.RepositoryIdentity“
Our Filenet people don't seem to know what that means. They've provided working code that basically looks the same as mine (but which I can't compile directly at the moment because it references parts of their project I don't have.)
So is the GlobalIdentity something I need to pass in through the web service? If so, how? If not, where is it configured?
Ok I finally spotted my mistake.
I had incorrectly set crt.TargetSpecification.classId to the name of the repository I was trying to use rather than to the correct classId.

Watin throws exception when Attach to IE

I am using for my Automation framework but I keep getting this error:
System.InvalidCastException: Specified cast is not valid.
IE newIE = IE.AttachTo<IE>(Find.ByUrl(new Regex("test.aspx")));
What is the cause for this? Thanks!
Please make sure you have added 'Interop.SHDocVw' reference and make 'Embedded Interop' property to 'False'. Also try to the test with admin rights.
Thanks,
Sham_

Resources