|
|
|||||||
Hi Is it possible to run XNET.exe without admin privileges ? My script works fine but not without rights !!! Maybe there are other ways to realise it ? Bye Sam |
||||||||
|
|
|||||||
what are you doing with xnet? |
||||||||
|
|
|||||||
I would like to check, If a service is running or not |
||||||||
|
|
|||||||
remotely ? Map to ipc$ with admin account first |
||||||||
|
|
|||||||
cant a normal user do just a "net start" to show a list of the running services? |
||||||||
|
|
|||||||
Something like this: Code:
And check @error after the above. @error will be 0 if service is found. Ussed it to find a custom installed services and shut it down if found. Works perfect. Never ussed xnet so don't know about that. |
||||||||
|
|
|||||||
Code:
|
||||||||
|
|
|||||||
Damn, you faster then me Just doing an edit to add the @error stuff. |
||||||||
|
|
|||||||
Why the heck would he then trying to use XNET.EXE ??? There'd be no sense in it if used locally |
||||||||
|
|
|||||||
WMIQUERY() should also address this need. Kent |
||||||||
|
|
|||||||
without admin privileges ? |
||||||||
|
|
|||||||
The original poster is talking about remote access, thus, by default, admin privileges would be needed, unless remote access security is lowered to allow non-admin accounts to perform such tasks. |
||||||||
|
|
|||||||
I check with the loginscript if the service run or not, If not i will send a message and start it. The problem for me was, that the users didn't have admin rights and so the xnet.exe can't query the service database. Now I will try it with the net start methode. Thanks Sam |
||||||||
|
|
|||||||
Yep Works really fine, but if I have services they have similar names Windows Management Instrumentation Driver Extensions Windows Management Instrumentation there I have the next problem, if I would only check the Windows Management Instrumentation service. Do you have an idea, how tho check that ? Bye Sam |
||||||||
|
|
|||||||
Put the full name in quotes. |
||||||||
|
|
|||||||
I have checked it, that didn't work |
||||||||
|
|
|||||||
you will have to look into using WSHpipe() then. Code:
|
||||||||
|
|
|||||||
that doesnt work error comma fails |
||||||||
|
|
|||||||
Allright Samuel, show us the line with which you check services with net start. If you say it works ok for your users but not with quoted Service names then you simply have a syntax error somewhere in there (NO need to use wshpipe shtuff) |
||||||||
|
|
|||||||
the problem is this Quote: he wants to check for the service "Windows Management Instrumentation" to see if it is running. if you run this. shell '%comspec% /c net start | find /i "Windows Management Instrumentation" > nul' and are depending on FIND's setting of the @error to determin if "Windows Management Instrumentation" is running or not. you will get a false positive if "Windows Management Instrumentation Driver Extensions" is running and "Windows Management Instrumentation" is not running. the FIND command will find both of these.... Windows Management Instrumentation Driver Extensions Windows Management Instrumentation |
||||||||
|
|
|||||||
Oh ... all right, if you say so Bryce |
||||||||
|
|
|||||||
It’s easy to test... Put Quote: Into a text file. And do this from a command prompt. Type test.txt | find /i "Windows Management Instrumentation" The find command finds both strings. Now remove "Windows Management Instrumentation" from the test file.... and the find command will find "Windows Management Instrumentation Driver Extensions" even if you were searching for "Windows Management Instrumentation" |
||||||||
|
|
|||||||
might be better using findstr or grep then with a regular expression |
||||||||
|
|
|||||||
with that way one won't be doomed to rely on wsh which might be disbaled for security reasons in the enterprise environment. Findtsr would be sufficient used with the /X switch, no? Plus it will be most probably available on any M$ OS ... |
||||||||
|
|
|||||||
not sure of os coverage for findstr but it is on 2000 and XP. you can use /x /e or a regular expression. |
||||||||
|
|
|||||||
Well FIND has been around since MS-DOS 2.0 so I think it will be safe to use for you |
||||||||
|
|
|||||||
but find does not cut it in this situation as it will provide a false positive since it does not support regular expressions, the concept of an exact match, or any idea of beginning or end of line. to be honest findstr may be available on a NT4 etc machine but I cant remember. I can only say for definite that findstr appears on xp and 2000. And again grep is also an alternative that I would end up using as I am used to using it but findstr is just as suitable and may be available as part of the OS |
||||||||
|
|
|||||||
thanks for your ideas. |
||||||||
|
|
|||||||
Findstr on NT 4 (3.51) ?? Definetly there, yeah |