Custome script

(imported topic written by shiva91)

Hi all,

I had a list of Active directory user’s information in a text file. My task is to find whether the Administrator account is renamed or not.

I have written a script for checking the user named “Administrator” is there or not. if the user “Administrator” is present, my script is working fine and displays the output that "Administrator account is not renamed ".

If the user “Administrator” not present, it shows the ouput as “Error: Singular expression refers to nonexistent object” but i require the output as “Administrator account is not renamed”

Can any one help regarding this.

Regards

Shiva

(imported comment written by Shlomi91)

Hi Shiva,

i would recommend a different approach:

what you want to know, is the local administrator name (it might be “Administrator” or it might be “JohnDoe”, doesn’t matter).

you can then filter out those called “Administrator”, and deal with them.

what i would suggest, is to query the registry, under this location:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

now, an administrator account will ALWAYS start with

S-1-5-

and end with

-500

.

you can then extract the username from the “ProfileImagePath” value from the registry key that starts with S-1-5- and ends with -500, from the key location i mentioned earlier.

another approach is to run a VBScript (found in Microsoft’s scripting center) at this URL:

http://www.microsoft.com/technet/scriptcenter/resources/qanda/jul05/hey0722.mspx

tweak the script to output to file, and read the text from that file using Bigfix.

BTW - this will work for Windows XP, haven’t tried it for 2000 / 2008 / Vista / Windows 7…

good luck,

Shlomi

(imported comment written by BenKus)

Shiva,

Will you post your action and/or relevance?

Ben

(imported comment written by shiva91)

Shlomi

I want to display the users related to the Active Directory not related to OS.

Ben

Relevance as follows:

if (exists file “userinfo.txt” of folder “c:”) then (if (exists (preceding text of first “,” of (following text of first “=” of lines containing “Administrator” of file “userinfo.txt” of folder “c:” as string))) then “not renamed” else “renamed”) else “not known”

contents of “userinfo.txt” as follows:


“CN=cdc,DC=IB00009”

“CN=temp temp. temp,DC=IB00009”

“CN=user,CN=Users,DC=IB00009”

“CN=IUSR_IB-00009,CN=Users,DC=IB00009”

“CN=IWAM_IB-00009,CN=Users,DC=IB00009”

“CN=ASPNET,CN=Users,DC=IB00009”

“CN=user1,CN=Users,DC=IB00009”

“CN=user2,CN=Users,DC=IB00009”

“CN=user3,CN=Users,DC=IB00009”


Siva

(imported comment written by BenKus)

Hi Siva,

You can try something like this:

if (exists file “C:\userinfo.txt”) then (if (exists lines whose (it contains “CN=Administrator”) of file “C:\userinfo.txt”) then “not renamed” else “renamed”) else “not known”

Or better yet:

if (exists local users whose (name of it = “Administrator”)) then “not renamed” else “renamed”

Ben

(imported comment written by shiva91)

Hi,

Greetings!

I need a custome script for getting first three octects from IP address for every client and then need to add fourth octet which is common to all the clients.

(Eg: X.X.X.200 where X.X.X will vary for the clients and last octet is same for all)

Thanks in advance.

Regards

Siva

(imported comment written by tig91)

Does this fit the bill?

q: (preceding text of last 
"." of (address of it as string) & 
".200") of ip interfaces whose (address of it != 
"127.0.0.1") of network A: 192.168.158.200 A: 192.168.30.200 A: 192.168.2.200 A: 192.168.1.200 T: 0.221 ms I: plural string