////// Logs a type and message for and exception (and all inner exceptions) on multiple log lines. /// Lines all contain a unique ID so they can be found if other lines get between them. /// /// Method name, or whatever you want. /// Custom message for the first log line /// Exception to log public static void LogException(string tag, string message, Exception ex) { string logItemId = Guid.NewGuid().ToString("N"); Log(tag, false, logItemId + " " + message); Log(tag, false, logItemId + " Exception: " + ex.GetType().Name + ": " + ex.Message); Exception Inner = ex.InnerException; int innerNumber = 1; while( Inner != null ) { Log(tag, false, logItemId + " Inner Exception " + innerNumber + " " + Inner.GetType().Name + ": " + Inner.Message); Inner = Inner.InnerException; innerNumber++; } }
There are several options for running PowerShell commands from Linux. Run the PowerShell script over a REST interface Unless you need a remote shell, the easiest option is to set up a REST interface for your PowerShell scripts. More information here . Using the winrm Ruby Gem https://github.com/WinRb/WinRM Using a WS-Management client on Linux Set up Windows for remote access: https://github.com/Openwsman/openwsman/wiki/winrm-over-openwsman-setup Install OpenWSMAN on Linux: http://openwsman.github.io/ Use Openwsman Command-Line Client: https://github.com/Openwsman/openwsman/wiki/openwsman-command-line-client OR - Use Ruby client bindings: http://users.suse.com/~kkaempf/openwsman/ Install an SSH server on Windows Install a Salt Minion on Windows Install Salt Master on Linux Install Python on Windows Install Salt Minion on Windows Open firewall on Windows for Salt access On Linux, run: # salt "winServer" cmd.run "powersh...
Comments
Post a Comment