Create ps1 from function