Windows - Deployment (Infra as code)

About

Infra as code.

How to connect to a Windows machine and execute deployment script.

List

psexec

psexec

psexec \\server01 -u domain\user -p [email protected] ipconfig /all 

WMI

WMI.NET or Windows Management Instrumentation ( applications in C#, Microsoft® Visual Basic, or Microsoft J#)

var processToRun = new[] { "notepad.exe" };
var connection = new ConnectionOptions();
connection.Username = "username";
connection.Password = "password";
var wmiScope = new ManagementScope(String.Format("\\\\{0}\\root\\cimv2", REMOTE_COMPUTER_NAME), connection);
var wmiProcess = new ManagementClass(wmiScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());
wmiProcess.InvokeMethod("Create", processToRun);

WINEXE

https://sourceforge.net/projects/winexe/ (Linux to Windows)

winexe -A credentials.cfg //remotehost "command arg"
 
username=user
password=pass
domain=workplace

Powershell

Powershell can be used to manage remote computers from a CLI using WMI (Windows Management Instrumentation). PowerShell remoting allows the execution of Powershell scripts and commands on remote computers.

Documentation / Reference


Powered by ComboStrap