Converted a script written in vbscript to powershell v2.0. When running the script in 32bit mode on Windows Server 2003 SP2 script runs in about 10 minutes and processes 6500 files. Running the same script on Windows Server 2008 R2 SP1 script is killed after 3 hours and processed less than 1000 files.
Both OS's are running in a VMWare vSphere 5.5 VM.
Script is to produce a CSV file for import into our Software Inventory System.
Script uses WMI calls to Win32_directory and CIM_DataFile to create an object that is use in generating CSV files.
On Windows Server 2003 SP2, used Export-CSV to generate the file and had no problems or performance issues. On Windows Server 2008 R2, have switched from using Export-CSV to Convert-CSV piped to Out-File to generate an appendable CSV file. Still Testing Convert-CSV, and it doesn't look good.
Tried to use pipelining with the WMI Objects, but it took looker than creating the WMI object and looping through them.
Any ideas on how to improve the performance would be appreciated.
DJ