-
-
25 Jul 2016 02:06:34 UTC
- Distribution: PowerShell
- Module version: 1.00
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues
- Testers (574 / 50 / 0)
- Kwalitee
Bus factor: 0- 75.14% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (20.28KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Log::Any
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
PowerShell - Wraps PowerShell commands;
VERSION
version 1.00
SYNOPSIS
use PowerShell; # Minimally PowerShell ->new('Mount-DiskImage, ['Image' => 'C:\\tmp\\foo.iso'], ['StorageType' => 'ISO']) ->pipe_to('Get-Volume') ->execute(); # Or explicitly PowerShell ->new( PowerShell::Pipeline ->new( PowerShell::Cmdlet ->new('Mount-DiskImage') ->parameter('Image', 'C:\\tmp\\foo.iso') ->parameter('StorageType', 'ISO')) ->add( PowerShell::Cmdlet ->new('Get-Volume'))) ->execute(); # Or just get the command my $command = PowerShell ->new('Mount-DiskImage', [Image => 'C:\\tmp\\foo.iso']) ->command(); # and execute it yourself my $result = `$command`;
DESCRIPTION
I know, I know, why would you want a scripting language to wrap a scripting language... In the real world, it happens. This can be really useful for automation that needs to do things that are exposed via PowerShell that would otherwise require jumping through more extensive hoops. It can also be quite useful when ssh'ing to a remote system to execute PowerShell commands. Anyway, the intent of this module is to simplify that use case.
CONSTRUCTORS
new($command, [@cmdlet_parameters])
Creates a new PowerShell command wrapper.
$command
is either a PowerShell::Pipeline, a PowerShell::Cmdlet, or a string containing a cmdlet name. If a string containing a cmdlet name, then@cmdlet_parameters
contains the parameters to that cmdlet.METHODS
command()
Returns a string form of the command.
execute()
Executes the command.
pipe_to($cmdlet, [@cmdlet_parameter)
Pipes the output to
$cmdlet
.AUTHOR
Lucas Theisen <lucastheisen@pastdev.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Lucas Theisen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
SEE ALSO
Please see those modules/websites for more information related to this module.
Module Install Instructions
To install PowerShell, copy and paste the appropriate command in to your terminal.
cpanm PowerShell
perl -MCPAN -e shell install PowerShell
For more information on module installation, please visit the detailed CPAN module installation guide.