Click here to Skip to main content
15,878,852 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C language exercise - beginner Pin
Bram van Kampen15-Oct-21 13:35
Bram van Kampen15-Oct-21 13:35 
GeneralRe: C language exercise - beginner Pin
Richard MacCutchan15-Oct-21 22:04
mveRichard MacCutchan15-Oct-21 22:04 
AnswerRe: C language exercise - beginner Pin
Bram van Kampen15-Oct-21 13:29
Bram van Kampen15-Oct-21 13:29 
Questiondata structure Pin
User 153459235-Oct-21 15:05
User 153459235-Oct-21 15:05 
AnswerRe: data structure PinPopular
Dave Kreskowiak5-Oct-21 17:11
mveDave Kreskowiak5-Oct-21 17:11 
AnswerRe: data structure Pin
Maximilien6-Oct-21 12:44
Maximilien6-Oct-21 12:44 
AnswerRe: data structure Pin
Bram van Kampen15-Oct-21 12:50
Bram van Kampen15-Oct-21 12:50 
QuestionRun powershell in C# Pin
jwradhe23-Sep-21 0:43
jwradhe23-Sep-21 0:43 
Hi!
I am pretty new to this, but im trying to present when the latest winupdate was done on computer, and only found in powershell to present that, and i tried to run it in C#, but no error and no result.
I understand that im doing wrong, but what is the best way to do this?

// Get Latest Windows Update
        private void LastWinUpd()
        {
           
            Runspace runspace = RunspaceFactory.CreateRunspace();
            runspace.Open();

            PowerShell ps = PowerShell.Create();
            ps.Runspace = runspace;

            //ps.Commands.AddScript("gwmi win32_quickfixengineering | Select-Object -expandProperty 'installedon' | sort installedon -desc | Select-Object -First 1 | Get-Date -Format 'yyyy - MM - dd K'");

            ps.AddCommand("$a = (New - Object - com 'Microsoft.Update.AutoUpdate').Results");
            ps.AddCommand("$a.LastInstallationSuccessDate | Get - Date - Format 'yyyy-MM-dd K'");

            Collection<PSObject> results = ps.Invoke();

            runspace.Close();

            StringBuilder stringBuilder = new StringBuilder();
            foreach (PSObject obj in results)
            {
                text_LastWinUpd.Text = obj.ToString();
            }
           
        }
        // END

AnswerRe: Run powershell in C# Pin
Richard MacCutchan23-Sep-21 0:49
mveRichard MacCutchan23-Sep-21 0:49 
AnswerRe: Run powershell in C# Pin
Richard Deeming23-Sep-21 1:14
mveRichard Deeming23-Sep-21 1:14 
GeneralRe: Run powershell in C# Pin
jwradhe23-Sep-21 1:48
jwradhe23-Sep-21 1:48 
GeneralRe: Run powershell in C# Pin
Richard Deeming23-Sep-21 2:43
mveRichard Deeming23-Sep-21 2:43 
GeneralRe: Run powershell in C# Pin
jwradhe23-Sep-21 2:49
jwradhe23-Sep-21 2:49 
GeneralRe: Run powershell in C# Pin
Richard Deeming23-Sep-21 3:21
mveRichard Deeming23-Sep-21 3:21 
GeneralRe: Run powershell in C# Pin
Dave Kreskowiak23-Sep-21 3:29
mveDave Kreskowiak23-Sep-21 3:29 
QuestionExample C code to use API "GetProcessIoCounters" Pin
Narasimha Moorthy20-Sep-21 1:01
Narasimha Moorthy20-Sep-21 1:01 
AnswerRe: Example C code to use API "GetProcessIoCounters" Pin
Richard MacCutchan20-Sep-21 1:11
mveRichard MacCutchan20-Sep-21 1:11 
GeneralRe: Example C code to use API "GetProcessIoCounters" Pin
Narasimha Moorthy20-Sep-21 19:14
Narasimha Moorthy20-Sep-21 19:14 
GeneralRe: Example C code to use API "GetProcessIoCounters" Pin
Richard MacCutchan20-Sep-21 21:19
mveRichard MacCutchan20-Sep-21 21:19 
GeneralRe: Example C code to use API "GetProcessIoCounters" Pin
Victor Nijegorodov20-Sep-21 21:21
Victor Nijegorodov20-Sep-21 21:21 
QuestionConnect to bluetooth service watch and read HR data Pin
Wim Van den Borre19-Sep-21 23:18
Wim Van den Borre19-Sep-21 23:18 
AnswerRe: Connect to bluetooth service watch and read HR data Pin
Richard MacCutchan19-Sep-21 23:20
mveRichard MacCutchan19-Sep-21 23:20 
GeneralRe: Connect to bluetooth service watch and read HR data Pin
Wim Van den Borre20-Sep-21 1:01
Wim Van den Borre20-Sep-21 1:01 
GeneralRe: Connect to bluetooth service watch and read HR data Pin
Richard MacCutchan20-Sep-21 1:09
mveRichard MacCutchan20-Sep-21 1:09 
GeneralRe: Connect to bluetooth service watch and read HR data Pin
Wim Van den Borre20-Sep-21 5:56
Wim Van den Borre20-Sep-21 5:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.