I'm not sure if I anderstand it right. But powershell is for scripting on the server. With powershell you can for example acces to to webparts and change their parameters from server console (shell, PowerShell ISE console).
May be you are asking about codebehind c# code, which you can use on on premis SharePoint (not in Sharepoint online).
I'm afraid you can't use powershell in webpart, but you can use c#, if you are developing your webPart.
If you're asking about running a PowerShell script from server-side of a Web part, that is technically possible but not recommended.
Here's how you can do it (you'll find a lot of articles on the subject on the Web): http://blogs.msdn.com/b/kebab/archive/2014/04/28/executing-powershell-scripts-from-c.aspx or https://stackoverflow.com/questions/11120452/run-powershell-script-from-c-sharp-application.
If your point is about running PS scripts on the client-side, this is not possible.