convert python script to powershell script for data collection