converted designer code to powershell