Help running script

Discussion in 'Scripting & Programming' started by SimonV, Dec 10, 2003.

  1. SimonV
    Honorary Member

    SimonV Petabyte Poster Gold Member

    6,651
    180
    258
    I'm trying to use this script:

    http://cwashington.netreach.net/depo/view.asp?Index=822&ScriptType=vbscript

    but I get an error: Syntax error. Usage: cscript badauths.vbs loginname

    I'm guessing I need to make some configuration to a HTML file but not sure what and where to put it. Any ideas.

    SimonV
    :D
     
    Last edited: Jan 2, 2015
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  2. Phil
    Honorary Member

    Phil Gigabyte Poster

    1,680
    7
    87
    how are you trying to run it ? what command line are you using?
     
    Certifications: MCSE:M & S MCSA:M CCNA CNA
    WIP: 2003 Upgrade, CCNA Upgrade
  3. Phil
    Honorary Member

    Phil Gigabyte Poster

    1,680
    7
    87
    I have just run it but to do so I had to change the following lines

    [code:1:a9eb600ab8]

    DomainName = "dc=" & wscript.arguments(0) & ",dc=dk"
    DomainName2 = wscript.arguments(0) & ".dk"
    [/code:1:a9eb600ab8]

    to
    [code:1:a9eb600ab8]

    DomainName = "dc=" & wscript.arguments(0) & ",dc=co,dc=uk"
    DomainName2 = wscript.arguments(0) & ".co.uk"

    [/code:1:a9eb600ab8]

    I used the command line
    [code:1:a9eb600ab8]
    cscript scriptname.vbs domain
    [/code:1:a9eb600ab8]
    without using the .co.uk in the domain name

    It opens an excel spreadsheet and proceeds to fill it with users, good script when it works tho :)
     
    Certifications: MCSE:M & S MCSA:M CCNA CNA
    WIP: 2003 Upgrade, CCNA Upgrade
  4. SimonV
    Honorary Member

    SimonV Petabyte Poster Gold Member

    6,651
    180
    258
    Thanks Phil

    OK, got it to run and output the excel file but its emply, my guess is the domain name. At the school they have a single label domain "itsuite" so what do I need to change?

    Si
    :D
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  5. SimonV
    Honorary Member

    SimonV Petabyte Poster Gold Member

    6,651
    180
    258
    Forget that last post. sorted it. Just removed the two parts below.


    [code:1:8962a4c9c4]DomainName = "dc=" & wscript.arguments(0) & ""
    DomainName2 = wscript.arguments(0) & ""[/code:1:8962a4c9c4]
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  6. SimonV
    Honorary Member

    SimonV Petabyte Poster Gold Member

    6,651
    180
    258
    Now that is one useful script, it runs a query on all users in a domain and outputs to an excel spreadsheet the date and time a user last logged in, if that date is greater then 30 days it flags them in a seperate column and also if the account has never been used then they also get flagged into a spererate column.
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  7. Nelix
    Honorary Member

    Nelix Gigabyte Poster

    1,416
    3
    82
    Si, My excel file is empty too but i cant even find the lines that you removed.
     
    Certifications: A+, 70-210, 70-290, 70-291, 74-409, 70-410, 70-411, 70-337, 70-347
    WIP: 70-346
  8. Nelix
    Honorary Member

    Nelix Gigabyte Poster

    1,416
    3
    82
    Found it, still empty
     
    Certifications: A+, 70-210, 70-290, 70-291, 74-409, 70-410, 70-411, 70-337, 70-347
    WIP: 70-346
  9. SimonV
    Honorary Member

    SimonV Petabyte Poster Gold Member

    6,651
    180
    258
    Sorry Nelix, dont remove all the text just then end parts like this.

    Before:
    [code:1:b3756488a0]DomainName = "dc=" & wscript.arguments(0) & ",dc=dk"
    DomainName2 = wscript.arguments(0) & ".dk" [/code:1:b3756488a0]

    After:
    [code:1:b3756488a0]DomainName = "dc=" & wscript.arguments(0) & ""
    DomainName2 = wscript.arguments(0) & ""[/code:1:b3756488a0]

    I only had to remove this info to get it to work on our single label domain.
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  10. Nelix
    Honorary Member

    Nelix Gigabyte Poster

    1,416
    3
    82
    OK I will give it a go

    Cheers
     
    Certifications: A+, 70-210, 70-290, 70-291, 74-409, 70-410, 70-411, 70-337, 70-347
    WIP: 70-346
  11. Nelix
    Honorary Member

    Nelix Gigabyte Poster

    1,416
    3
    82
    Still no joy

    If i just double click it in Explorer I get:

    Syntax error. Usage: cscript badauths.vbs loginname

    If i run it from the command line the i get the following message appear in the command line box:

    quser.vbs(170, 2) (null): A referal was returned from the server.
     
    Certifications: A+, 70-210, 70-290, 70-291, 74-409, 70-410, 70-411, 70-337, 70-347
    WIP: 70-346
  12. SimonV
    Honorary Member

    SimonV Petabyte Poster Gold Member

    6,651
    180
    258
    Whats the name of the domain that your running this on?
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  13. Nelix
    Honorary Member

    Nelix Gigabyte Poster

    1,416
    3
    82
    When I join a machine to the domain I input LabourNT, however when I look at the network identification tab (in my computer > properties) it says 'new.labour.org.uk'
     
    Certifications: A+, 70-210, 70-290, 70-291, 74-409, 70-410, 70-411, 70-337, 70-347
    WIP: 70-346
  14. SimonV
    Honorary Member

    SimonV Petabyte Poster Gold Member

    6,651
    180
    258
    My guess and this is a total guess is that you need to change the following:

    [code:1:c1030bc65e]DomainName = "dc=" & wscript.arguments(0) & ",dc=dk"
    DomainName2 = wscript.arguments(0) & ".dk" [/code:1:c1030bc65e]
    to
    [code:1:c1030bc65e]DomainName = "dc=" & wscript.arguments(0) & ",dc=org,dc=uk"
    DomainName2 = wscript.arguments(0) & ".org.uk" [/code:1:c1030bc65e]

    and in the command line use:

    But I'm sure Phil (script master) will put me right.

    Si
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  15. Nelix
    Honorary Member

    Nelix Gigabyte Poster

    1,416
    3
    82
    I will give it ago as soon as i get into work tomorrow morning and let you know, I did change the above but ommitted the LabourNT from the command prompt so you could be on the right track here.
     
    Certifications: A+, 70-210, 70-290, 70-291, 74-409, 70-410, 70-411, 70-337, 70-347
    WIP: 70-346
  16. Phil
    Honorary Member

    Phil Gigabyte Poster

    1,680
    7
    87
    I think you may need to enter

    [code:1:1f2cf5904f]
    DomainName = "dc=" & wscript.arguments(0) & ",dc=labour,dc=org,dc=uk"
    DomainName2 = wscript.arguments(0) & ".labour.org.uk"
    [/code:1:1f2cf5904f]

    and use the following on the command line.

    [code:1:1f2cf5904f]
    cscript scriptname.vbs new
    [/code:1:1f2cf5904f]

    It looks like new is a sub-domain of labour.org.uk from you previous posts.
     
    Certifications: MCSE:M & S MCSA:M CCNA CNA
    WIP: 2003 Upgrade, CCNA Upgrade
  17. Nelix
    Honorary Member

    Nelix Gigabyte Poster

    1,416
    3
    82
    Thanks Phil, I will try both ideas tomorrow and let you know
     
    Certifications: A+, 70-210, 70-290, 70-291, 74-409, 70-410, 70-411, 70-337, 70-347
    WIP: 70-346
  18. SimonV
    Honorary Member

    SimonV Petabyte Poster Gold Member

    6,651
    180
    258
    oh yeah, Phils makes more sence now, but I'm learning. :thumbleft
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  19. Nelix
    Honorary Member

    Nelix Gigabyte Poster

    1,416
    3
    82
    I have TRied both solutions, thanks to you both, however Phils method seems to work the best. The script completes successfully but the excel file is still empty.
     
    Certifications: A+, 70-210, 70-290, 70-291, 74-409, 70-410, 70-411, 70-337, 70-347
    WIP: 70-346
  20. Nelix
    Honorary Member

    Nelix Gigabyte Poster

    1,416
    3
    82
    I dont suppose anyone can shed any light on this yet can they
     
    Certifications: A+, 70-210, 70-290, 70-291, 74-409, 70-410, 70-411, 70-337, 70-347
    WIP: 70-346

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.