• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

C#. VB

Does anyone know of a way to convert the following PS code to C# or VB to create an exe file?



$password = get-content C:\cred1.txt | convertto-securestring

$credential = new-object -typename System.Management.Automation.PSCredential -argumentlist "admin",$password

#Use invoke-command to execute the operation#

Invoke-command –computername <computer>  -credential $credential –scriptblock {ftpuser}
0
TonyElam
Asked:
TonyElam
  • 2
2 Solutions
 
MlandaTCommented:
Consider calling the PowerShell script from C# code, then package the C# code into an exe. Powershell will still be needed on the end user's computer though. This might help: http://www.eggheadcafe.com/software/aspnet/33581867/how-to-call-powershell-script-from-c.aspx
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now