remote-management

How to access WinRM in C#

时间秒杀一切 提交于 2019-12-18 14:14:56
问题 I'd like to create a small application that can collect system information (Win32_blablabla) using WinRM as opposed to WMI. How can i do that from C#? The main goal is to use WS-Man (WinRm) as opposed to DCOM (WMI). 回答1: I guess the easiest way would be to use WSMAN automation. Reference wsmauto.dll from windwos\system32 in your project: then, code below should work for you. API description is here: msdn: WinRM C++ API IWSMan wsman = new WSManClass(); IWSManConnectionOptions options =

osascript set volume isn't working via ssh

假装没事ソ 提交于 2019-12-12 02:27:47
问题 here is my situation. User A is currently logged on Computer A . User B logs into Computer A via ssh. User B runs via terminal a osascript ( osascript -e 'set volume 0' ) here is my error log: Oct 20 13:25:17 osascript[29389] <Error>: Set a breakpoint at CGSLogError to catch errors as they are logged. Oct 20 13:25:17 osascript[29389] <Error>: This user is not allowed access to the window system right now. Oct 20 13:25:17 osascript[29389] <Warning>: CGSConnectionByID: 0 is not a valid

Azure Powershell Runbook - Invoke commands on remote VM (ARM a.k.a. V2)

大憨熊 提交于 2019-12-11 00:01:50
问题 What I need I want to have an automation runbook that executes commands on a remote VM (the VM is a V2 or "Resource Manager" VM). I found examples to make that work with Classic VMs but I can't make it work for RM VMs (best I found: https://alexandrebrisebois.wordpress.com/2015/08/14/azure-automation-remote-powershell-and-a-virtual-machine/). Does anybody have an example of running powershell commands on a remote V2 VM in an automation runbook? Where I'm stuck currently I have tried to adjust

How to access WinRM in C#

非 Y 不嫁゛ 提交于 2019-11-30 11:13:16
I'd like to create a small application that can collect system information (Win32_blablabla) using WinRM as opposed to WMI. How can i do that from C#? The main goal is to use WS-Man (WinRm) as opposed to DCOM (WMI). I guess the easiest way would be to use WSMAN automation. Reference wsmauto.dll from windwos\system32 in your project: then, code below should work for you. API description is here: msdn: WinRM C++ API IWSMan wsman = new WSManClass(); IWSManConnectionOptions options = (IWSManConnectionOptions)wsman.CreateConnectionOptions(); if (options != null) { try { // options.UserName = ???; /