C#. VB

Posted on 2011-05-03
Last Modified: 2012-05-11
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}
Question by:TonyElam
    LVL 30

    Accepted Solution

    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:
    LVL 30

    Assisted Solution


    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now