- COPYRIGHT AND LICENSE
- SEE ALSO
PowerShell - Wraps PowerShell commands;
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`;
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.
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.
Returns a string form of the command.
Executes the command.
Pipes the output to
Lucas Theisen <email@example.com>
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.
Please see those modules/websites for more information related to this module.