bsharath
asked on
Is there any way that i run a script and i have today's installed softwares into a csv file.
Hi,
Is there any way that i run a script and i have today's installed softwares into a csv file.
So i have the script run on a list of machine names in a txt file so it displays the machine name and todays installed software name.
So i can schedule it and run the macro every day . And i have a review on the softwares each day.
Regards
Sharath
Is there any way that i run a script and i have today's installed softwares into a csv file.
So i have the script run on a list of machine names in a txt file so it displays the machine name and todays installed software name.
So i can schedule it and run the macro every day . And i have a review on the softwares each day.
Regards
Sharath
ASKER
Attached is the format
ScreenShot012.bmp
ScreenShot012.bmp
Can you post your date /t?
ASKER
date.t? sorry could not understand
Any way the format is " MM/DD/YYYY"
Any way the format is " MM/DD/YYYY"
OK. When you get to your office try date /t
Some workstations will be this
Thu 08/07/2008
Some workstations will be this
Thu 08/07/2008
ASKER
Yes i get this
Thu 08/07/2008
Thu 08/07/2008
All-in-one script!
Includes:
https://www.experts-exchange.com/questions/23628507/Need-a-logon-script-that-can-even-be-run-on-a-list-of-computers-to-get-the-software-details-into-individual-files.html?anchorAnswerId=22179334#a22179334
If you wanted I could modify it to log all software install dates or maybe specify a range? All software installed after some date like 20080101?
Includes:
https://www.experts-exchange.com/questions/23628507/Need-a-logon-script-that-can-even-be-run-on-a-list-of-computers-to-get-the-software-details-into-individual-files.html?anchorAnswerId=22179334#a22179334
If you wanted I could modify it to log all software install dates or maybe specify a range? All software installed after some date like 20080101?
SETLOCAL ENABLEDELAYEDEXPANSION
Set CSVFolder=\\servername\sharename
Set CompList=\\servername\sharename\Complist.txt
Set LOGFolder=C:\Logs
Set justdate=
for /f "tokens=2" %%a in ('date /t') do set justdate=%%a
IF NOT DEFINED justdate for /f "tokens=1" %%a in ('date /t') do set justdate=%%a
Set InstallDate=%justdate:~-4%%justdate:~0,2%%justdate:~3,2%
REM Override today's date with a specified date
REM Set InstallDate=20080227
FOR /f "tokens=1 delims=," %%m in (%CompList%) DO (
PING -n 1 -w 100 %%m | FIND /i "Reply from"
IF NOT ERRORLEVEL 1 (
REG QUERY \\%%m\hklm\system\CurrentControlSet
IF NOT ERRORLEVEL 1 (
FOR /f "tokens=*" %%a in ('reg query \\%%m\hklm\software\microsoft\windows\currentversion\uninstall ^| find /i "uninstall\"') DO (
SET ParentDisplayName=
FOR /f "tokens=1,2,*" %%b in ('reg query "\\%%m\%%a" ^| find /i "ParentDisplayname"') do SET ParentDisplayName=%%d
ECHO !ParentDisplayName! | FIND /i " - Software Updates"
IF ERRORLEVEL 1 (
FOR /f "tokens=1,2,*" %%e in ('reg query "\\%%m\%%a" ^| find /i "Displayname"') do (
ECHO %%g | FIND /i "Windows" | FIND /i "hotfix"
IF ERRORLEVEL 1 (
ECHO %%g | FIND /i "Security Update For"
IF ERRORLEVEL 1 (
findstr /i /l /c:%%m "%CSVFolder%\%%g.csv"
IF ERRORLEVEL 1 (
ECHO %%m>>"%CSVFolder%\%%g.csv"
findstr /i /l /c:%%m "%LOGFolder%\Success.txt"
IF ERRORLEVEL 1 ECHO %%m>>"%LOGFolder%\Success.txt"
)
FOR /f "tokens=1,2,*" %%h in ('reg query "\\%%m\%%a" ^| find /i "installdate" ^| FIND /i "%InstallDate%"') do (
findstr /i /l /c:"%%m","%%g" "%CSVFolder%\%%g.csv"
ECHO "%%m","%%g">>"%CSVFolder%\%InstallDate% Software installed.csv"
)
)
)
)
)
)
) ELSE (
ECHO %%m,Remote registry failed.>>"%LOGFolder%\Unsuccessful.txt"
)
) ELSE (
ECHO %%m,Did not reply to ping.>>"%LOGFolder%\Unsuccessful.txt"
)
)
Oh. I added /i to the findstr so the findstr is not case sensitive now.
ASKER
Sorry my date format at office is as
Fri 08/08/2008
When i run this script i get the same output as the other one.
I dont mind if both the jobs can be done with one script. Rather would be happy.
IThe script just runs on the local machine not the machine names in the txt file.
Fri 08/08/2008
When i run this script i get the same output as the other one.
I dont mind if both the jobs can be done with one script. Rather would be happy.
IThe script just runs on the local machine not the machine names in the txt file.
ASKER
Sorry my date format at office is as
Fri 08/08/2008
When i run this script i get the same output as the other one.
I dont mind if both the jobs can be done with one script. Rather would be happy.
IThe script just runs on the local machine not the machine names in the txt file.
Fri 08/08/2008
When i run this script i get the same output as the other one.
I dont mind if both the jobs can be done with one script. Rather would be happy.
IThe script just runs on the local machine not the machine names in the txt file.
Try the below script.
This line doesn't like UNC path.
FOR /f "tokens=1 delims=," %%m in (%CompList%) DO (
Changed to this:
FOR /f "tokens=1 delims=," %%m in ('type "%CompList%"') DO (
This line doesn't like UNC path.
FOR /f "tokens=1 delims=," %%m in (%CompList%) DO (
Changed to this:
FOR /f "tokens=1 delims=," %%m in ('type "%CompList%"') DO (
SETLOCAL ENABLEDELAYEDEXPANSION
Set CSVFolder=\\servername\sharename
Set CompList=\\servername\sharename\Complist.txt
Set LOGFolder=C:\Logs
Set justdate=
for /f "tokens=2" %%a in ('date /t') do set justdate=%%a
IF NOT DEFINED justdate for /f "tokens=1" %%a in ('date /t') do set justdate=%%a
Set InstallDate=%justdate:~-4%%justdate:~0,2%%justdate:~3,2%
REM Override today's date with a specified date
REM Set InstallDate=20080227
FOR /f "tokens=1 delims=," %%m in ('type "%CompList%"') DO (
PING -n 1 -w 100 %%m | FIND /i "Reply from"
IF NOT ERRORLEVEL 1 (
REG QUERY \\%%m\hklm\system\CurrentControlSet
IF NOT ERRORLEVEL 1 (
FOR /f "tokens=*" %%a in ('reg query \\%%m\hklm\software\microsoft\windows\currentversion\uninstall ^| find /i "uninstall\"') DO (
SET ParentDisplayName=
FOR /f "tokens=1,2,*" %%b in ('reg query "\\%%m\%%a" ^| find /i "ParentDisplayname"') do SET ParentDisplayName=%%d
ECHO !ParentDisplayName! | FIND /i " - Software Updates"
IF ERRORLEVEL 1 (
FOR /f "tokens=1,2,*" %%e in ('reg query "\\%%m\%%a" ^| find /i "Displayname"') do (
ECHO %%g | FIND /i "Windows" | FIND /i "hotfix"
IF ERRORLEVEL 1 (
ECHO %%g | FIND /i "Security Update For"
IF ERRORLEVEL 1 (
findstr /i /l /c:%%m "%CSVFolder%\%%g.csv"
IF ERRORLEVEL 1 (
ECHO %%m>>"%CSVFolder%\%%g.csv"
findstr /i /l /c:%%m "%LOGFolder%\Success.txt"
IF ERRORLEVEL 1 ECHO %%m>>"%LOGFolder%\Success.txt"
)
FOR /f "tokens=1,2,*" %%h in ('reg query "\\%%m\%%a" ^| find /i "installdate" ^| FIND /i "%InstallDate%"') do (
findstr /i /l /c:"%%m","%%g" "%CSVFolder%\%%g.csv"
ECHO "%%m","%%g">>"%CSVFolder%\%InstallDate% Software installed.csv"
)
)
)
)
)
)
) ELSE (
ECHO %%m,Remote registry failed.>>"%LOGFolder%\Unsuccessful.txt"
)
) ELSE (
ECHO %%m,Did not reply to ping.>>"%LOGFolder%\Unsuccessful.txt"
)
)
ASKER
I have used the same script as mentioned with 2 UNC paths and one C Drive. But still just the local machine softwares come out. Not all machines in the txt file
ASKER
I have used the same script as mentioned with 2 UNC paths and one C Drive. But still just the local machine softwares come out. Not all machines in the txt file
ASKER
AT now i got the problem solved.
I have the computer names in a txt file as Computers.txt and always used to change the file name as computers.txt instead on comlist
now the new problem is the scan stops with some machines as "Access denied" and some "Permissions denied"
So can you skip such errors.So the scan continues on other comp's
I have the computer names in a txt file as Computers.txt and always used to change the file name as computers.txt instead on comlist
now the new problem is the scan stops with some machines as "Access denied" and some "Permissions denied"
So can you skip such errors.So the scan continues on other comp's
ASKER
Where in should i change the dates in the script. So i just get softwares installed in a range.
ASKER
Where in should i change the dates in the script. So i just get softwares installed in a range.
ASKER
AT any help on this
Oh. Did I not respond yet? I must need more sleep. I'll have to reply in a couple hours.
I had completed this yesterday but forgot to post it.
Currently set for Software install since February 27th, 2008. If you really just want today's software then REM Line 14.
Currently set for Software install since February 27th, 2008. If you really just want today's software then REM Line 14.
SETLOCAL ENABLEDELAYEDEXPANSION
Set CSVFolder=\\servername\sharename
Set CompList=\\servername\sharename\Complist.txt
Set LOGFolder=C:\Logs
Set justdate=
for /f "tokens=2" %%a in ('date /t') do set justdate=%%a
IF NOT DEFINED justdate for /f "tokens=1" %%a in ('date /t') do set justdate=%%a
Set InstallDate=%justdate:~-4%%justdate:~0,2%%justdate:~3,2%
REM Override today's date with a date software was Installed after
Set InstallDate=20080227
FOR /f "tokens=1 delims=," %%m in ('type "%CompList%"') DO (
PING -n 1 -w 100 %%m | FIND /i "Reply from"
IF NOT ERRORLEVEL 1 (
REG QUERY \\%%m\hklm\system\CurrentControlSet
IF NOT ERRORLEVEL 1 (
FOR /f "tokens=*" %%a in ('reg query \\%%m\hklm\software\microsoft\windows\currentversion\uninstall ^| find /i "uninstall\"') DO (
SET ParentDisplayName=
FOR /f "tokens=1,2,*" %%b in ('reg query "\\%%m\%%a" ^| find /i "ParentDisplayname"') do SET ParentDisplayName=%%d
ECHO !ParentDisplayName! | FIND /i " - Software Updates"
IF ERRORLEVEL 1 (
FOR /f "tokens=1,2,*" %%e in ('reg query "\\%%m\%%a" ^| find /i "Displayname"') do (
ECHO %%g | FIND /i "Windows" | FIND /i "hotfix"
IF ERRORLEVEL 1 (
ECHO %%g | FIND /i "Security Update For"
IF ERRORLEVEL 1 (
findstr /i /l /c:%%m "%CSVFolder%\%%g.csv"
IF ERRORLEVEL 1 (
ECHO %%m>>"%CSVFolder%\%%g.csv"
findstr /i /l /c:%%m "%LOGFolder%\Success.txt"
IF ERRORLEVEL 1 ECHO %%m>>"%LOGFolder%\Success.txt"
)
FOR /f "tokens=1,2,*" %%h in ('reg query "\\%%m\%%a" ^| find /i "installdate"') do (
IF "%%j" GEQ "%InstallDate%" (
findstr /i /l /c:"%%m","%%g" "%CSVFolder%\%%j Software Installed.csv"
ECHO "%%m","%%g">>"%CSVFolder%\%%j Software installed.csv"
)
)
)
)
)
)
)
) ELSE (
ECHO %%m,Remote registry failed.>>"%LOGFolder%\Unsuccessful.txt"
)
) ELSE (
ECHO %%m,Did not reply to ping.>>"%LOGFolder%\Unsuccessful.txt"
)
)
ASKER
AT just one Question...
What is the difference between the previous solution and this...
The previous should get all softwares except hotfixes,Patches.
This post should get just the softwares till date from the given range.
As the previous post also has the date range?
What is the difference between the previous solution and this...
The previous should get all softwares except hotfixes,Patches.
This post should get just the softwares till date from the given range.
As the previous post also has the date range?
ASKER
AT just one Question...
What is the difference between the previous solution and this...
The previous should get all softwares except hotfixes,Patches.
This post should get just the softwares till date from the given range.
As the previous post also has the date range?
What is the difference between the previous solution and this...
The previous should get all softwares except hotfixes,Patches.
This post should get just the softwares till date from the given range.
As the previous post also has the date range?
The difference should only be getting the installed date list of applications.
All the Office2007.CSV, Acrobat6.csv, etc... are not governed by the date range.
So the previous version only retrieved software installed today (20080810). If you missed running this on Friday and Saturday. You'll never get those software with the previous script because it was only doing today.
Running the new version you can have a date range for installed software. So even if someone with a laptop was away on vacation busily installing software. The next time they are in and you run the script it will be reported. Simply look for modified dates to see what it found. The script does not (Opps I forgot to put in the IF ERRORLEVEL 1) put in duplicate entries.
I'll double check the script if that's not what you're seeing.
You know what would be really amazing? Is if you could uninstall a piece a software you don't want on machines once you found it in the log.
All the Office2007.CSV, Acrobat6.csv, etc... are not governed by the date range.
So the previous version only retrieved software installed today (20080810). If you missed running this on Friday and Saturday. You'll never get those software with the previous script because it was only doing today.
Running the new version you can have a date range for installed software. So even if someone with a laptop was away on vacation busily installing software. The next time they are in and you run the script it will be reported. Simply look for modified dates to see what it found. The script does not (Opps I forgot to put in the IF ERRORLEVEL 1) put in duplicate entries.
I'll double check the script if that's not what you're seeing.
You know what would be really amazing? Is if you could uninstall a piece a software you don't want on machines once you found it in the log.
SETLOCAL ENABLEDELAYEDEXPANSION
Set CSVFolder=\\servername\sharename
Set CompList=\\servername\sharename\Complist.txt
Set LOGFolder=C:\Logs
Set justdate=
for /f "tokens=2" %%a in ('date /t') do set justdate=%%a
IF NOT DEFINED justdate for /f "tokens=1" %%a in ('date /t') do set justdate=%%a
Set InstallDate=%justdate:~-4%%justdate:~0,2%%justdate:~3,2%
REM Override today's date with a date software was Installed after
Set InstallDate=20080227
FOR /f "tokens=1 delims=," %%m in ('type "%CompList%"') DO (
PING -n 1 -w 100 %%m | FIND /i "Reply from"
IF NOT ERRORLEVEL 1 (
REG QUERY \\%%m\hklm\system\CurrentControlSet
IF NOT ERRORLEVEL 1 (
FOR /f "tokens=*" %%a in ('reg query \\%%m\hklm\software\microsoft\windows\currentversion\uninstall ^| find /i "uninstall\"') DO (
SET ParentDisplayName=
FOR /f "tokens=1,2,*" %%b in ('reg query "\\%%m\%%a" ^| find /i "ParentDisplayname"') do SET ParentDisplayName=%%d
ECHO !ParentDisplayName! | FIND /i " - Software Updates"
IF ERRORLEVEL 1 (
FOR /f "tokens=1,2,*" %%e in ('reg query "\\%%m\%%a" ^| find /i "Displayname"') do (
ECHO %%g | FIND /i "Windows" | FIND /i "hotfix"
IF ERRORLEVEL 1 (
ECHO %%g | FIND /i "Security Update For"
IF ERRORLEVEL 1 (
findstr /i /l /c:%%m "%CSVFolder%\%%g.csv"
IF ERRORLEVEL 1 (
ECHO %%m>>"%CSVFolder%\%%g.csv"
findstr /i /l /c:%%m "%LOGFolder%\Success.txt"
IF ERRORLEVEL 1 ECHO %%m>>"%LOGFolder%\Success.txt"
)
FOR /f "tokens=1,2,*" %%h in ('reg query "\\%%m\%%a" ^| find /i "installdate"') do (
IF "%%j" GEQ "%InstallDate%" (
findstr /i /l /c:"%%m","%%g" "%CSVFolder%\%%j Software Installed.csv"
IF ERRORLEVEL 1 ECHO "%%m","%%g">>"%CSVFolder%\%%j Software installed.csv"
)
)
)
)
)
)
)
) ELSE (
ECHO %%m,Remote registry failed.>>"%LOGFolder%\Unsuccessful.txt"
)
) ELSE (
ECHO %%m,Did not reply to ping.>>"%LOGFolder%\Unsuccessful.txt"
)
)
ASKER
Thank U.
Now if i need to get all softwares no matter what date it was installed. Which is the right one...
Now if i need to get all softwares no matter what date it was installed. Which is the right one...
ASKER
Thank U.
Now if i need to get all softwares no matter what date it was installed. Which is the right one...
Now if i need to get all softwares no matter what date it was installed. Which is the right one...
Those are in the individual named applications.csv but you could change the install date to something like 19800101 and it will also put all software installed by install date. Of course this is as long as the software tagged the install date in the registry.
ASKER
AT i just tried the final scri[pt as above changeing the date as
Set InstallDate=20080808
But i get all softwares that were installed in 12/03/2005
As this machine was built on year 2005. All softwares were installed then. So the software i installed now is MSN. So just this software had to come as results. But all the softwares come as output
Set InstallDate=20080808
But i get all softwares that were installed in 12/03/2005
As this machine was built on year 2005. All softwares were installed then. So the software i installed now is MSN. So just this software had to come as results. But all the softwares come as output
ASKER
AT i just tried the final scri[pt as above changeing the date as
Set InstallDate=20080808
But i get all softwares that were installed in 12/03/2005
As this machine was built on year 2005. All softwares were installed then. So the software i installed now is MSN. So just this software had to come as results. But all the softwares come as output
Set InstallDate=20080808
But i get all softwares that were installed in 12/03/2005
As this machine was built on year 2005. All softwares were installed then. So the software i installed now is MSN. So just this software had to come as results. But all the softwares come as output
So are you finding it in:
20051203 Software Installed.csv
or something like
Microsoft MSN.csv
The Date one should not show up but the Microsoft MSN.csv should. This is only because I put this in from the previous post. If it's confusing then I'll remove it and only give you the date option.
20051203 Software Installed.csv
or something like
Microsoft MSN.csv
The Date one should not show up but the Microsoft MSN.csv should. This is only because I put this in from the previous post. If it's confusing then I'll remove it and only give you the date option.
SETLOCAL ENABLEDELAYEDEXPANSION
Set CSVFolder=\\servername\sharename
Set CompList=\\servername\sharename\Complist.txt
Set LOGFolder=C:\Logs
Set justdate=
for /f "tokens=2" %%a in ('date /t') do set justdate=%%a
IF NOT DEFINED justdate for /f "tokens=1" %%a in ('date /t') do set justdate=%%a
Set InstallDate=%justdate:~-4%%justdate:~0,2%%justdate:~3,2%
REM Override today's date with a date software was Installed after
Set InstallDate=200800808
FOR /f "tokens=1 delims=," %%m in ('type "%CompList%"') DO (
PING -n 1 -w 100 %%m | FIND /i "Reply from"
IF NOT ERRORLEVEL 1 (
REG QUERY \\%%m\hklm\system\CurrentControlSet
IF NOT ERRORLEVEL 1 (
FOR /f "tokens=*" %%a in ('reg query \\%%m\hklm\software\microsoft\windows\currentversion\uninstall ^| find /i "uninstall\"') DO (
SET ParentDisplayName=
FOR /f "tokens=1,2,*" %%b in ('reg query "\\%%m\%%a" ^| find /i "ParentDisplayname"') do SET ParentDisplayName=%%d
ECHO !ParentDisplayName! | FIND /i " - Software Updates"
IF ERRORLEVEL 1 (
FOR /f "tokens=1,2,*" %%e in ('reg query "\\%%m\%%a" ^| find /i "Displayname"') do (
ECHO %%g | FIND /i "Windows" | FIND /i "hotfix"
IF ERRORLEVEL 1 (
ECHO %%g | FIND /i "Security Update For"
IF ERRORLEVEL 1 (
FOR /f "tokens=1,2,*" %%h in ('reg query "\\%%m\%%a" ^| find /i "installdate"') do (
IF "%%j" GEQ "%InstallDate%" (
findstr /i /l /c:"%%m","%%g" "%CSVFolder%\%%j Software Installed.csv"
IF ERRORLEVEL 1 ECHO "%%m","%%g">>"%CSVFolder%\%%j Software installed.csv"
)
)
)
)
)
)
)
) ELSE (
ECHO %%m,Remote registry failed.>>"%LOGFolder%\Unsuccessful.txt"
)
) ELSE (
ECHO %%m,Did not reply to ping.>>"%LOGFolder%\Unsuccessful.txt"
)
)
ASKER
At...
Now when i run i get many csv files created date wise.
Now what does this script do...
Does it create files based on the dates and place any software installed in that date into the relevant files?
As i have the date as 200800808
Should it not get just the 08-08-2008 installed software?
Now when i run i get many csv files created date wise.
Now what does this script do...
Does it create files based on the dates and place any software installed in that date into the relevant files?
As i have the date as 200800808
Should it not get just the 08-08-2008 installed software?
ASKER
At...
Now when i run i get many csv files created date wise.
Now what does this script do...
Does it create files based on the dates and place any software installed in that date into the relevant files?
As i have the date as 200800808
Should it not get just the 08-08-2008 installed software?
Now when i run i get many csv files created date wise.
Now what does this script do...
Does it create files based on the dates and place any software installed in that date into the relevant files?
As i have the date as 200800808
Should it not get just the 08-08-2008 installed software?
Correct. That's what it's supposed to do.
Opps. There's too many zeros.
The install date should be
20080808
So when the invalid date of 200800808 it was doing a comparison but 20080080 would produce a list of software installed in 2008.
Sorry. It's actually using a range so from 08-08-2008 until today. Create a CSV file for each install date software.
The install date should be
20080808
So when the invalid date of 200800808 it was doing a comparison but 20080080 would produce a list of software installed in 2008.
Sorry. It's actually using a range so from 08-08-2008 until today. Create a CSV file for each install date software.
ASKER
AT i changed the date and ran the script but still get files created as
3-24-2008 Software installed.csv
7-24-2008 Software installed.csv
20080811 Software installed.csv
5-28-2008 Software installed.csv
20080808 Software installed.csv
3-24-2008 Software installed.csv
7-24-2008 Software installed.csv
20080811 Software installed.csv
5-28-2008 Software installed.csv
20080808 Software installed.csv
ASKER
AT i changed the date and ran the script but still get files created as
3-24-2008 Software installed.csv
7-24-2008 Software installed.csv
20080811 Software installed.csv
5-28-2008 Software installed.csv
20080808 Software installed.csv
3-24-2008 Software installed.csv
7-24-2008 Software installed.csv
20080811 Software installed.csv
5-28-2008 Software installed.csv
20080808 Software installed.csv
Oh. Some software has put the install date as 3-24-2008, 7-24-2008 and 5-28-2008.
I believe the correct format should have been 20080324, 20080724 and 20080528.
I'll need to update the script to take this date format into consideration.
Can you tell me which software has put this date format in? I'm concerned on what happens if someone decides the date format is dd-mm-yyyy
I believe the correct format should have been 20080324, 20080724 and 20080528.
I'll need to update the script to take this date format into consideration.
Can you tell me which software has put this date format in? I'm concerned on what happens if someone decides the date format is dd-mm-yyyy
ASKER
I have many of my products into the csv files.
ASKER
At any help...
Still i get many dates queried and got into the folder..
Many dated csv files are created
Still i get many dates queried and got into the folder..
Many dated csv files are created
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
so i need to change for todays installs
as
Set InstallDate=20080814
as
Set InstallDate=20080814
ASKER
so i need to change for todays installs
as
Set InstallDate=20080814
as
Set InstallDate=20080814
ASKER
so i need to change for todays installs
as
Set InstallDate=20080814
as
Set InstallDate=20080814
Yes.
ASKER
AT i ran the script with this changed...
Set InstallDate=20080814
But still get a lot of csv files with different dates
Set InstallDate=20080814
But still get a lot of csv files with different dates
ASKER
AT i ran the script with this changed...
Set InstallDate=20080814
But still get a lot of csv files with different dates
Set InstallDate=20080814
But still get a lot of csv files with different dates
Can you post some csvs?
ASKER
Thanks AT...It was my mistake. The date was mentioned wrongly. THANK U for such patient help ....
Now i have few questions here.
1. Can we run this script as a login script. Will this slow down the login?
2. Can we have a date range set like from 20080808 to 20080909.
3. Can we have the other script changed into a login script that gets all softwares installed in a machines
Please let me know if any of these are possible. I shall post individual posts on this...
Now i have few questions here.
1. Can we run this script as a login script. Will this slow down the login?
2. Can we have a date range set like from 20080808 to 20080909.
3. Can we have the other script changed into a login script that gets all softwares installed in a machines
Please let me know if any of these are possible. I shall post individual posts on this...
1. Yes it will slow down the login. You would need to remove some things to make this script work from the logon script. I would just setup a scheduled task on my workstation to query the workstations on the network.
2. I'll need to add another parameter but yes it can. Attached.
3. Yup. Attached
2. I'll need to add another parameter but yes it can. Attached.
3. Yup. Attached
SETLOCAL ENABLEDELAYEDEXPANSION
Set CSVFolder=\\servername\sharename
Set CompList=\\servername\sharename\Complist.txt
Set LOGFolder=C:\Logs
Set justdate=
for /f "tokens=2" %%a in ('date /t') do set justdate=%%a
IF NOT DEFINED justdate for /f "tokens=1" %%a in ('date /t') do set justdate=%%a
Set InstallDate=%justdate:~-4%%justdate:~0,2%%justdate:~3,2%
Set InstallEndDate=%justdate:~-4%%justdate:~0,2%%justdate:~3,2%
REM Override today's date with a date software was Installed after
Set InstallDate=20080605
REM Override today's date with a date software was Installed before
Set InstallEndDate=20080605
FOR /f "tokens=1 delims=," %%m in ('type "%CompList%"') DO (
PING -n 1 -w 100 %%m | FIND /i "Reply from"
IF NOT ERRORLEVEL 1 (
REG QUERY \\%%m\hklm\system\CurrentControlSet
IF NOT ERRORLEVEL 1 (
FOR /f "tokens=*" %%a in ('reg query \\%%m\hklm\software\microsoft\windows\currentversion\uninstall ^| find /i "uninstall\"') DO (
SET ParentDisplayName=
FOR /f "tokens=1,2,*" %%b in ('reg query "\\%%m\%%a" ^| find /i "ParentDisplayname"') do SET ParentDisplayName=%%d
ECHO !ParentDisplayName! | FIND /i " - Software Updates"
IF ERRORLEVEL 1 (
FOR /f "tokens=1,2,*" %%e in ('reg query "\\%%m\%%a" ^| find /i "Displayname"') do (
ECHO %%g | FIND /i "Windows" | FIND /i "hotfix"
IF ERRORLEVEL 1 (
ECHO %%g | FIND /i "Security Update For"
IF ERRORLEVEL 1 (
findstr /i /l /c:%%m "%CSVFolder%\%%g.csv"
IF ERRORLEVEL 1 (
ECHO %%m>>"%CSVFolder%\%%g.csv"
findstr /i /l /c:%%m "%LOGFolder%\Success.txt"
IF ERRORLEVEL 1 ECHO %%m>>"%LOGFolder%\Success.txt"
)
FOR /f "tokens=1,2,*" %%h in ('reg query "\\%%m\%%a" ^| find /i "installdate"') do (
Set SWInstallDate=%%j
ECHO !SWInstallDate! | FIND "-"
IF NOT ERRORLEVEL 1 (
Set Month=!SWInstallDate:~0,2!
IF "!Month:~1,1!" == "-" (
Set Month=0!Month:~0,1!
Set Day=!SWInstallDate:~2,2!
Set Year=!SWInstallDate:~5,4!
) ELSE (
Set Day=!SWInstallDate:~3,2!
Set Year=!SWInstallDate:~6,4!
)
Set SWInstallDate=!Year!!Month!!Day!
)
IF "!SWInstallDate!" GEQ "%InstallDate%" IF "!SWInstallDate!" LEQ "%InstallEndDate%" (
findstr /i /l /c:"%%m""","""%%g" "%CSVFolder%\!SWInstallDate! Software Installed.csv"
IF ERRORLEVEL 1 ECHO "%%m","%%g">>"%CSVFolder%\!SWInstallDate! Software installed.csv"
)
)
)
)
)
)
)
) ELSE (
ECHO %%m,Remote registry failed.>>"%LOGFolder%\Unsuccessful.txt"
)
) ELSE (
ECHO %%m,Did not reply to ping.>>"%LOGFolder%\Unsuccessful.txt"
)
)
ASKER
AT thanks...Why i asked if login script is better as to do this on 2000+ machines i think it may take 2 days to scan manually.
What do you think?
What do you think?
ASKER
AT
https://www.experts-exchange.com/questions/23648713/Need-help-with-this-software-logging-script-that-can-get-softwares-installed-between-date-ranges.html
By changing what can i get all softwares installed in the machines listed
https://www.experts-exchange.com/questions/23648713/Need-help-with-this-software-logging-script-that-can-get-softwares-installed-between-date-ranges.html
By changing what can i get all softwares installed in the machines listed
You could always create say 5 lists with 5 batch files to collect the data. Run them at the same time.
All software is attached in my previous post.
All software is attached in my previous post.
What date format are you using?
date /t