That looks like the code for a function to start a job in Powershell so I'm trying to guess at what it was originally and figure out what you are trying to do :). You can start by wrapping the code in a function by just doing something like:
Then insert all the code you have here after the curly braces. Then end the function with curly braces.
I would guess you renamed the parameters in the code you found:
And those are the parameters for the function. You want those back to how they originally were - it's like declare in t-sql. From the code, they originally were
So put those back how they were originally. Then if you are trying to execute the function against the server DB4 to run the job named Test, you would call the function like:
Start-SQLJob "DB4" "Test"
That should work, I just did the same and it worked. It looks like they had another parameter in there for the job step but it should still just run without adding that in. The job steps I leave alone for now - it's something you can play with in trying to work with this function.
And another approach that is way easier would be to use dbatools. It's a module that is pretty popular and has a lot of different SQL Server cmdlets you can use. And it has Start-DbaAgentJob. I get it that your just getting started and it's good to work on getting this working just for the learning experience. But dbatools is a great resource you may want to look into and play with as well. Here is the link: