Turn Powershell Script Into Function Definition