powershell

package
v0.4.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunCommand

func RunCommand(command string) ([]byte, error)

RunCommand executes a given powershell command.

When the command throws a powershell exception, RunCommand will return the exception message as error.

func RunCommandWithJSONResult

func RunCommandWithJSONResult(command string, v interface{}) error

RunCommandWithJSONResult executes a given powershell command. The command will be wrapped with ConvertTo-Json.

You can Wrap your command with @(<cmd>) to ensure that the returned json is an array

When the command throws a powershell exception, RunCommandf will return the exception message as error.

func RunCommandf

func RunCommandf(command string, a ...interface{}) ([]byte, error)

RunCommandf executes a given powershell command. Command argument formats according to a format specifier (See fmt.Sprintf).

When the command throws a powershell exception, RunCommandf will return the exception message as error.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL