Click here to Skip to main content
15,846,826 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C language exercise - beginner Pin
Bram van Kampen15-Oct-21 14:35
Bram van Kampen15-Oct-21 14:35 
GeneralRe: C language exercise - beginner Pin
Richard MacCutchan15-Oct-21 23:04
mveRichard MacCutchan15-Oct-21 23:04 
AnswerRe: C language exercise - beginner Pin
Bram van Kampen15-Oct-21 14:29
Bram van Kampen15-Oct-21 14:29 
Questiondata structure Pin
User 153459235-Oct-21 16:05
User 153459235-Oct-21 16:05 
AnswerRe: data structure Pin
Dave Kreskowiak5-Oct-21 18:11
mveDave Kreskowiak5-Oct-21 18:11 
AnswerRe: data structure Pin
Maximilien6-Oct-21 13:44
Maximilien6-Oct-21 13:44 
AnswerRe: data structure Pin
Bram van Kampen15-Oct-21 13:50
Bram van Kampen15-Oct-21 13:50 
QuestionRun powershell in C# Pin
jwradhe23-Sep-21 1:43
jwradhe23-Sep-21 1: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 1:49
mveRichard MacCutchan23-Sep-21 1:49 
AnswerRe: Run powershell in C# Pin
Richard Deeming23-Sep-21 2:14
mveRichard Deeming23-Sep-21 2:14 
GeneralRe: Run powershell in C# Pin
jwradhe23-Sep-21 2:48
jwradhe23-Sep-21 2:48 
GeneralRe: Run powershell in C# Pin
Richard Deeming23-Sep-21 3:43
mveRichard Deeming23-Sep-21 3:43 
GeneralRe: Run powershell in C# Pin
jwradhe23-Sep-21 3:49
jwradhe23-Sep-21 3:49 
GeneralRe: Run powershell in C# Pin
Richard Deeming23-Sep-21 4:21
mveRichard Deeming23-Sep-21 4:21 
GeneralRe: Run powershell in C# Pin
Dave Kreskowiak23-Sep-21 4:29
mveDave Kreskowiak23-Sep-21 4:29 
QuestionExample C code to use API "GetProcessIoCounters" Pin
Narasimha Moorthy20-Sep-21 2:01
Narasimha Moorthy20-Sep-21 2:01 
AnswerRe: Example C code to use API "GetProcessIoCounters" Pin
Richard MacCutchan20-Sep-21 2:11
mveRichard MacCutchan20-Sep-21 2:11 
GeneralRe: Example C code to use API "GetProcessIoCounters" Pin
Narasimha Moorthy20-Sep-21 20:14
Narasimha Moorthy20-Sep-21 20:14 
GeneralRe: Example C code to use API "GetProcessIoCounters" Pin
Richard MacCutchan20-Sep-21 22:19
mveRichard MacCutchan20-Sep-21 22:19 
GeneralRe: Example C code to use API "GetProcessIoCounters" Pin
Victor Nijegorodov20-Sep-21 22:21
Victor Nijegorodov20-Sep-21 22:21 
QuestionConnect to bluetooth service watch and read HR data Pin
Wim Van den Borre20-Sep-21 0:18
Wim Van den Borre20-Sep-21 0:18 
AnswerRe: Connect to bluetooth service watch and read HR data Pin
Richard MacCutchan20-Sep-21 0:20
mveRichard MacCutchan20-Sep-21 0:20 
GeneralRe: Connect to bluetooth service watch and read HR data Pin
Wim Van den Borre20-Sep-21 2:01
Wim Van den Borre20-Sep-21 2:01 
GeneralRe: Connect to bluetooth service watch and read HR data Pin
Richard MacCutchan20-Sep-21 2:09
mveRichard MacCutchan20-Sep-21 2:09 
GeneralRe: Connect to bluetooth service watch and read HR data Pin
Wim Van den Borre20-Sep-21 6:56
Wim Van den Borre20-Sep-21 6: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.