|
|
 |
 |
 |
 |
Perl Programming Language
|
 |
 |
 |
 |
 |
 |
 |
 |
Processing a Computer List
Hi guys hope you can help me with a perl script. We are running multiple platforms - NT and XP. I have a computer list in computers.txt Each system has a local administrator account, let's say it is <computername>\administrator, with password 'password'. What I need to do is to: 1) Determine if the system is NT or XP 2) If it is NT, then connect by <computername>\administrator, with password 'password', then write a line to an output file called output.txt the status of the browser service. So the format of the output.txt would be something like: <computername>, operatingsystem, servicename, status 3) If it is XP, then connect by <domain1>\simon, with password 'simtest', then write a line to an output file called output.txt with the same 4 columns as 2). 4) While the script is running, a status of 'connecting to <computername> would be great. Any help greatly appreciated. Simon
SimonH wrote: > Hi guys hope you can help me with a perl script. > We are running multiple platforms - NT and XP. > I have a computer list in computers.txt > Each system has a local administrator account, let's say it is > <computername>\administrator, with password 'password'. > What I need to do is to: > 1) Determine if the system is NT or XP > 2) If it is NT, then connect by <computername>\administrator, with password > 'password', then write a line to an output file called output.txt the status > of the browser service. So the format of the output.txt would be something > like: > <computername>, operatingsystem, servicename, status > 3) If it is XP, then connect by <domain1>\simon, with password 'simtest', > then write a line to an output file called output.txt with the same 4 > columns as 2). > 4) While the script is running, a status of 'connecting to <computername> > would be great. > Any help greatly appreciated. > Simon
Not a Perl solution, but if you have a copy of Microsoft's srvinfo.exe I believe you can determine this information without the need to authenticate. C:\>srvinfo.exe Server Name: SPARKY Security: Users NT Type: NT Advanced Server - Personal Version: 5.1 Build: 2600, Service Pack 2 Current Type: Uniprocessor Free Product Name: Microsoft Windows XP Registered Owner: len Registered Organization: ProductID: xxxxx-OEM-xxxxxxxx-xxxxx Original Install Date: Wed Sep 25 21:25:42 2002 Domain: Error 2 PDC: Error 2453 CPU[0]: x86 Family 15 Model 2 Stepping 4: 2519 MHz Hotfixes: [ServicePackUninstall]: [Q147222]: [KB932168]: [KB931836]: [KB931784]: [KB931768]: [KB931261]: .... [KB873339]: [KB873333]: Drive: [FileSys] [ Size ] [ Free ] [ Used ] C$ NTFS 38147 15650 22497 D$ NTFS 114479 89074 25405 G$ NTFS 238473 164957 73516 Services: [Stopped] Adobe LM Service [Stopped] Alerter [Running] Application Layer Gateway Service [Stopped] Application Management [Running] Windows Audio [Running] Background Intelligent Transfer Service [Running] BrSplService [Running] Computer Browser [Stopped] Indexing Service [Stopped] ClipBook [Stopped] COM+ System Application [Running] Cryptographic Services [Running] DCOM Server Process Launcher [Running] DefWatch [Running] DHCP Client .... [Stopped] Network Provisioning Service Network Card [0]: Network Card [1]: System Up Time: 0 Days, 0 Hr, 7 Min, 32 Sec or Server Name: serv700 Security: Users NT Type: NT Member Server - Enterprise Version: 5.0 Build: 2195, Service Pack 4 Current Type: Uniprocessor Free Product Name: Microsoft Windows 2000 Registered Owner: home Registered Organization: home ProductID: xxxxx-xxx-xxxxxxx-xxxxx Original Install Date: Sun Dec 17 13:24:27 2000 Domain: Error 2 PDC: Error 1717 IP Address: 192.168.1.37 CPU[0]: x86 Family 15 Model 6 Stepping 5: 3341 MHz Hotfixes: [Update Rollup 1]: [ServicePackUninstall]: [Q828026]: [Q147222]: [KB932168]: [KB931784]: [KB931768-IE6SP1-20070219.120000]: [KB930178]: [KB929969-IE6SP1-20061220.120000]: ... [KB329115]: Drive: [FileSys] [ Size ] [ Free ] [ Used ] C$ NTFS 15359 11388 3971 D$ NTFS 137267 96209 41058 Services: [Running] Alerter [Stopped] Application Management [Stopped] Background Intelligent Transfer Service [Running] Computer Browser [Stopped] Indexing Service [Stopped] ClipBook [Running] Distributed File System ... [Stopped] Wireless Configuration Network Card [0]: System Up Time: 5 Days, 18 Hr, 8 Min, 35 Sec -- Len
Hi Len! Thanks for this...but Im really looking at a perl solution for this. Thanks very much to you anyway. Appreciate it. "l v" <veatc @yahoo.com> wrote in message news:1361itkoqcnte02@news.supernews.com...
> SimonH wrote: >> Hi guys hope you can help me with a perl script. >> We are running multiple platforms - NT and XP. >> I have a computer list in computers.txt >> Each system has a local administrator account, let's say it is >> <computername>\administrator, with password 'password'. >> What I need to do is to: >> 1) Determine if the system is NT or XP >> 2) If it is NT, then connect by <computername>\administrator, with >> password 'password', then write a line to an output file called >> output.txt the status of the browser service. So the format of the >> output.txt would be something like: >> <computername>, operatingsystem, servicename, status >> 3) If it is XP, then connect by <domain1>\simon, with password 'simtest', >> then write a line to an output file called output.txt with the same 4 >> columns as 2). >> 4) While the script is running, a status of 'connecting to <computername> >> would be great. >> Any help greatly appreciated. >> Simon > Not a Perl solution, but if you have a copy of Microsoft's srvinfo.exe I > believe you can determine this information without the need to > authenticate. > C:\>srvinfo.exe > Server Name: SPARKY > Security: Users > NT Type: NT Advanced Server - Personal > Version: 5.1 > Build: 2600, Service Pack 2 > Current Type: Uniprocessor Free > Product Name: Microsoft Windows XP > Registered Owner: len > Registered Organization: > ProductID: xxxxx-OEM-xxxxxxxx-xxxxx > Original Install Date: Wed Sep 25 21:25:42 2002 > Domain: Error 2 > PDC: Error 2453 > CPU[0]: x86 Family 15 Model 2 Stepping 4: 2519 MHz > Hotfixes: > [ServicePackUninstall]: > [Q147222]: > [KB932168]: > [KB931836]: > [KB931784]: > [KB931768]: > [KB931261]: > .... > [KB873339]: > [KB873333]: > Drive: [FileSys] [ Size ] [ Free ] [ Used ] > C$ NTFS 38147 15650 22497 > D$ NTFS 114479 89074 25405 > G$ NTFS 238473 164957 73516 > Services: > [Stopped] Adobe LM Service > [Stopped] Alerter > [Running] Application Layer Gateway Service > [Stopped] Application Management > [Running] Windows Audio > [Running] Background Intelligent Transfer Service > [Running] BrSplService > [Running] Computer Browser > [Stopped] Indexing Service > [Stopped] ClipBook > [Stopped] COM+ System Application > [Running] Cryptographic Services > [Running] DCOM Server Process Launcher > [Running] DefWatch > [Running] DHCP Client > .... > [Stopped] Network Provisioning Service > Network Card [0]: > Network Card [1]: > System Up Time: 0 Days, 0 Hr, 7 Min, 32 Sec > or > Server Name: serv700 > Security: Users > NT Type: NT Member Server - Enterprise > Version: 5.0 > Build: 2195, Service Pack 4 > Current Type: Uniprocessor Free > Product Name: Microsoft Windows 2000 > Registered Owner: home > Registered Organization: home > ProductID: xxxxx-xxx-xxxxxxx-xxxxx > Original Install Date: Sun Dec 17 13:24:27 2000 > Domain: Error 2 > PDC: Error 1717 > IP Address: 192.168.1.37 > CPU[0]: x86 Family 15 Model 6 Stepping 5: 3341 MHz > Hotfixes: > [Update Rollup 1]: > [ServicePackUninstall]: > [Q828026]: > [Q147222]: > [KB932168]: > [KB931784]: > [KB931768-IE6SP1-20070219.120000]: > [KB930178]: > [KB929969-IE6SP1-20061220.120000]: > ... > [KB329115]: > Drive: [FileSys] [ Size ] [ Free ] [ Used ] > C$ NTFS 15359 11388 3971 > D$ NTFS 137267 96209 41058 > Services: > [Running] Alerter > [Stopped] Application Management > [Stopped] Background Intelligent Transfer Service > [Running] Computer Browser > [Stopped] Indexing Service > [Stopped] ClipBook > [Running] Distributed File System > ... > [Stopped] Wireless Configuration > Network Card [0]: > System Up Time: 5 Days, 18 Hr, 8 Min, 35 Sec > -- > Len
SimonH wrote: > Hi Len! > Thanks for this...but Im really looking at a perl solution for this. Thanks > very much to you anyway. Appreciate it.
Well then [untested]: perl -e "print `srvinfo.exe`" ... >> C:\>srvinfo.exe
-- Bob Walton Email: http://bwalton.com/cgi-bin/emailbob.pl
Beware, multi-posted here, with a different Subject: "Computer List (Pls hlp!)". -- Affijn, Ruud "Gewoon is een tijger."
Bob Walton wrote: > SimonH wrote: >> Hi Len! >> Thanks for this...but Im really looking at a perl solution for this. >> Thanks very much to you anyway. Appreciate it. > Well then [untested]: > perl -e "print `srvinfo.exe`" > ... >>> C:\>srvinfo.exe
That was my first thought and what I do when there is an existing tool which gives me exactly what I want. Simon - you may want to look at Win32::Process::Info. -- Len
Thanks Bob....really appreciate it. "l v" <veatc @yahoo.com> wrote in message news:1365l8n1e1cre22@news.supernews.com...
> Bob Walton wrote: >> SimonH wrote: >>> Hi Len! >>> Thanks for this...but Im really looking at a perl solution for this. >>> Thanks very much to you anyway. Appreciate it. >> Well then [untested]: >> perl -e "print `srvinfo.exe`" >> ... >>>> C:\>srvinfo.exe > That was my first thought and what I do when there is an existing tool > which gives me exactly what I want. > Simon - you may want to look at Win32::Process::Info. > -- > Len
|
 |
 |
 |
 |
|