|
I just recently began exploring WMI since you can't do everything with ADSI. My current project is to compile a list of domain users in my company with Local Administrator privileges on our numerous servers so that we may clean out any users who ought not have these powers.
The problem is I can't seem to get the records I want from my query. Take a look at the following code:
strComputer = "."<br />
Set objSWbemServices = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")<br />
Set colSWbemObjectSet = objSWbemServices.ExecQuery("SELECT FullName," & _<br />
"Domain, LocalAccount FROM Win32_UserAccount WHERE LocalAccount = false")<br />
For Each objSWbemObject In colSWbemObjectSet<br />
WScript.Echo " Domain: " & objSWbemObject.Domain & vbCrLf & _<br />
"Full Name: " & objSWbemObject.FullName & vbCrLf<br />
Next
This query returns what appears to be all of the user accounts in my domain. I assume this is because our general domain users group is a member of the local "Users" group. How can I make the query only collect domain users who are also members of the local "Administrators" group?
Thanks,
Seth Kelly
|
|
|
|
|
Allright, well I've made some progress here. I have a script that runs almost perfectly, but has a habit of getting stuck. Here's the essential code:
Set fso = CreateObject("Scripting.FileSystemObject")<br />
Set scribe = fso.CreateTextFile("c:\LocalAdminList.txt")<br />
Set boxes = fso.OpenTextFile("c:\servers.txt",1,false)<br />
<br />
DO<br />
Set CompConn = GetObject("winmgmts:\\" & box & "\root\cimv2")<br />
Set ColUsers = CompConn.ExecQuery("SELECT * FROM Win32_GroupUser WHERE" &_ "GroupComponent='Win32_Group.Domain=\'BUILTIN\',Name=\'Administrators\'' ")<br />
<br />
FOR EACH User IN ColUsers<br />
Username = User.PartComponent<br />
scribe.writeline Username<br />
(*script gets stuck here*)<br />
NEXT<br />
<br />
LOOP WHILE(boxes.atendofstream = false)<br />
Simple enough. Yet when I run the script against a list of a few hundred servers it gets stuck somewhere between the second and third server. Specifically, it never gets out of the FOR loop after it processes the last user in the second server's collection. When I remove this server from the list the script makes it through 5 more servers and then same deal. No errors, it just sits and doesn't do anything. Does anybody have any idea why this script won't drop out of the FOR loop when it ought to? Alternatively, is there any code to make it drop out after a certain period of innactiviy?
|
|
|
|
|
Well, I might as well continue answering my own questions. A bit of searching and I found this problem with WMI queries. Essentially, that report tells me that even though I ran my query looking for local users it still queries my entire domain to find them. My very large network isn't exactly standardized software-wise, so I assume the servers that this script hangs on don't have the proper hotfixes to handle my query.
"EXIT FOR" is of course the equivalent to "break" that I was looking for, but I'm still curious about a condition that would break off the loop after a certain amount of inactivity. The query in my code runs server-side, so my end is indeed inactive while it queries endlessly. Another more useful tip would be one that explains how to improve my query.
My problem is...essentially...solved, but not nearly to my satisfaction. Any help would still be much appreciated.
|
|
|
|
|
Is there any compelling reason I would want to learn PHP if I already know perl?
Outside of maintaining somebody elses PHP script, or curiosity.
Are there substantial differences that would warrant picking it up? I've sort of figured I can do anything in perl that someone can do in PHP, if not more, so why bother, but maybe I'm way off.
BW
The Biggest Loser
"People look so snooty, take pills make them moody Automatic bazootie, zero to tutti frutti" -Hollywood Freaks
|
|
|
|
|
not really if you're comfortable with perl
the new php5 has a whole bunch of object oriented features coming and has some very neat stuff to interface with all sorts of db's etc BUT... like i said in the lounge just now ... doesnt it all come down to spitting out html over a stateless protocol anyways?
"there is no spoon" biz stuff about me
|
|
|
|
|
l a u r e n wrote:
doesnt it all come down to spitting out html over a stateless protocol anyways?
True, as long as you shuffle your characters the way you want to, what difference does it make.
BW
The Biggest Loser
"People look so snooty, take pills make them moody Automatic bazootie, zero to tutti frutti" -Hollywood Freaks
|
|
|
|
|
Hi,
Is it somehow possible to force the width of a table column be fixed (in HTML) no matter how huge the cell content might be?
For example in the example below, the width of the table increases if I insert a very long string with no spaces to it. So is it possible to force the text to be wrapped eventhough there's no spaces in it?
<html>
<head>
<title>page</title>
</head>
<body>
<table border="1" bordercolor="black" width="300" >
<tr>
<td width="150"> </td>
<td width="150"> </td>
</tr>
</table>
</body>
</html>
-Jussi
|
|
|
|
|
Hi there,
Try the following:
JussiL wrote:
STYLE="word-wrap:break-word;"> | |
Hope this helps,
Andy
|
|
|
|
|
Yeah, this is exactly what I needed. Thanks
-Jussi
|
|
|
|
|
hi, i really need someone to help.
i have to fax from an asp application but i dont want to use a fax server or the option of far using e-mail.
i need a code or an interface in which i can enter a number and choose a file and send fax.plz do help me. i'm in great trouble. my application is incomplete without this .
|
|
|
|
|
afaik u need a backend module to take care of the actual fax layer of the transport ... writing this in asp would not be a good idea me thinks
"there is no spoon" biz stuff about me
|
|
|
|
|
well maybe im losing the plot and all but i have searched for the last hour trying to find info on what commands media player supports within a web page via javascript and come up with jack ... nada ... niente ... zip ... zilch
before i go mad and shoot my computer can anyone point me a source of info?
thnx
"there is no spoon" biz stuff about me
|
|
|
|
|
|
I've noticed when sites require SSL they typically have a subdomain or folder assigned to strictly hold SSL required scripts.
Is this becuz SSL must be mapped to enentired directory or something?
Can you not enable SSL for a single script? or would all scripts then cause SSL to be used between any HTTP request?
Cheers
How do I print my voice mail?
|
|
|
|
|
>> Is this becuz SSL must be mapped to enentired directory or something?
That does not match my experience.
>> or would all scripts then cause SSL to be used between any HTTP request?
No, SSL uses the HTTPS protocol not HTTP.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
palbano wrote:
That does not match my experience.
So I can have all my files in a single directory and only have one script use SSL?
How would I accomplish this? In my scripts POST would I just submit to HTTPS instead of HTTP?
So I would have to use an absolute url, not a relative one like I usually do and basically https://www.soandso.com/secure_script.php
Cheers
How do I print my voice mail?
|
|
|
|
|
>> just submit to HTTPS instead of HTTP?
Well that's all from a software development point of view. Obtaining and installing the certificate in the Web Server... not so simple and completely server dependent.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
I am getting the error - "Undefined Index Job_Code, Account_Code, welfare_tag & Amount"
in the following code (PHP & MYSQL).
while($rs=mysql_fetch_array($result,MYSQL_BOTH))
{
$Job_Code=$rs["Job_Code"];
$Account_Code=$rs["Account_Code"];
$welfare_tag=$rs["welfare_tag"];
$Amount=$rs["Amount"];
}
|
|
|
|
|
first off:
$row = mysql_fetch_assoc($res);
$job_code = $row['job_code'];
$account_code = $row['account_code'];
$welfare_tag = $row['welfare_tag'];
$amount = $row['amount'];
is a neater way to write the code
i think ur error is coming in from the case of the variable names ... always use lower case for everything ... it makes life simpler in the long run trust me
"there is no spoon" biz stuff about me
|
|
|
|
|
I am working on a website in which i have to provide printing to the user. It is basically a report which user can print.
The problem i am facing is the report is coming with Horizontal and Vertical bars i mean its a big report i use window.print() command for printing this report but it only print a single page i mean only the area which is coming in current window rest report is not printed.
Please suggest me what i can do in this scenerio and its very urgent.
|
|
|
|
|
I am working on a problem wherein I have following requirement.
1) I need to control the access to the business logic through a webservice which logs the request with details like IP Address/Date-Time/ Authentication etc.
2) The buiness logic needs to run at Client side as it involves lot of data which the client wouldnt want to be exposed over the net.
Can I implement this by executing the Web Service Locally on the client side ? Or is there any other better way to achieve this. I am struck at this and need help.
Thanks a lot in advance for the suggestions.
|
|
|
|
|
I am not sure what you need to do...
For sure you can create secure web services.
You can also consume the web service from the client by using the web service behaviour or XMLHTTP.
The web service behaviour is a nice API but I think that it only works on IE and not on Netscape or Opera.
try the following link:
http://www.codeproject.com/vb/net/VbNetWebServBeh.asp[^]
theJazzyBrain
Excelence is not an act, but a habit Aristotle
|
|
|
|
|
How to handle interupts in VB Scripting.
Details about interupts - If my VB script is running and then based upon certain even or alarm I need to interupt the VB scripting execution and take the programm flow control and perform certain predefined tasks based upon the interupt.
sushama
|
|
|
|
|
Right, to set the scene, I am creating a website for my partner to sell Floral Arrangements.
Now when certain events crops up, i.e. Mothers Day, Fathers Day, Easter, etc, we would like a reminder to appear. No problem.
The problem is, the dates for the events change each year, and can't think of a logical way in code to determine the date automatically, as Easter for example falls on a different date each year.
Do any of you know of a way to calculate when Special Occasion dates occur each year?
Any suggestions?
---
Peter M
|
|
|
|
|
Hi
First you should make a list of all the special days you are interested in, and then do a Google search on how to calculate when is each one. For example, Easter, is the Sunday following the Paschal Full Moon (PFM) date for the year; Mother's Day is always the second Sunday of May and so on. There is a way to calculate each an every one of them.
Good luck,
Fabian
|
|
|
|