Jump to content

Inventory - Server Side (Win 2008 x64)


Recommended Posts

I've modified the script located here:

to my needs and desired output. It works on my Windows 7 machine, but not on Windows 2008 server, x64.

It reports error "Line 10009 (File "C:\audit\Audit.exe"): Error: Subscript used with non-Array variable."

What am I missing here?

Code is attached in this post.

Audit.au3

Edited by skysel
Link to comment
Share on other sites

To start, the large line number is due to a failed loop in the app. The first thing I can think of is that something you are reading from the OS that exists in Windows 7 is not present in Server 2008. It may be important to know if you have Windows 7 SP1, and if it is x86 or x64. Are you testing with UAC enabled or disabled? Also, your 2008, it is R2 or is it RTM with a service pack?

You may need to do the task of checking each of the individual WMI reads to verify that they all exist, but just looking real quick at your script I notice you do not check if each WMI result is an Object. The reason being is that this script is set to do each thing even if it would return a null value, such as printers. The only reason you should collect the printer info (for example) is if a printer actually exists. If it doesn't, then don't run the command.

Regarding UserAccounts. If this server is a Domain Controller, there may not be any Local User Accounts on the system.

Anyways, I imagine you are getting an error because one of the items you are checking in WMI has no data OR has a symbol in there (such as a forward slash) that is breaking the script.

Link to comment
Share on other sites

To start, the large line number is due to a failed loop in the app. The first thing I can think of is that something you are reading from the OS that exists in Windows 7 is not present in Server 2008. It may be important to know if you have Windows 7 SP1, and if it is x86 or x64. Are you testing with UAC enabled or disabled? Also, your 2008, it is R2 or is it RTM with a service pack?

You may need to do the task of checking each of the individual WMI reads to verify that they all exist, but just looking real quick at your script I notice you do not check if each WMI result is an Object. The reason being is that this script is set to do each thing even if it would return a null value, such as printers. The only reason you should collect the printer info (for example) is if a printer actually exists. If it doesn't, then don't run the command.

Regarding UserAccounts. If this server is a Domain Controller, there may not be any Local User Accounts on the system.

Anyways, I imagine you are getting an error because one of the items you are checking in WMI has no data OR has a symbol in there (such as a forward slash) that is breaking the script.

I have commented out the printers and the useraccounts. I'm checking script once again for additional line comment out.

On the other hand: Windows 7 SP1, UAC disabled, Windows 2008 R2 Enterprise SP1.

Eitherway, I'll re-check the script if I left any stuff thats need to be hidden.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...