Skip to content

Scripts Page

Jakub Šindelář edited this page Sep 17, 2020 · 6 revisions

Scripts page is the most important part of the application. All of the magic happens here. You can browse your available commands there, display their help and launch them.

#c5f015 Attention: Lazy Admin is quite simple and nearly anyone should be able to use it intuitively, but learning all about this page is heavily recommended to avoid any possible mistakes. Making unnecessary mistakes could lead to potential loses to your company, considering you are using such a powerful tool that PowerShell is.

Image 01: Sample appearance of Scripts Page. Lazy Admin Scripts Page Screenshot

Searching and Filtering commands

If you have master definition and its scripts definitions set up, you should see table of commands, which can be filtered in two ways.

#c5f015 Note: Developers may read more how to setup definitions on Definitions.

  • Using search bar in the title bar, you can filter commands based on:
    • Command Name
    • Friendly Name
    • Description

Image 02: With search bar, you can filter both commands table and history table. You can press ❌ icon to clear search bar. Lazy Admin Scripts Page Screenshot

  • Using menu icon on the left from search bar, you can open application's menu, where commands can be filtered by the name of the definition file they belong to.

Image 03: Application's left menu containing filter for scripts based on definitions files and Settings and About links. Lazy Admin Scripts Page Screenshot

History

On the right side of the search bar, you can open history tab, which is also part of the Scripts page. History tab allows you to browse your previous commands you executed, view their results or run them again, preloading parameters they have been executed with. That applies also to workflows, so you can jump straight to the middle of workflow, skipping previous steps.

Image 04: History tab, one executed command per row. Row contains time and date of execution, command's current step and total number of steps, name of command and buttons to display Results and to Repeat command. Lazy Admin Scripts Page Screenshot

Online help

Each command can have external help, which is opened and loaded using help icon ❔ on the right side of the table. If command has no external help defined, description is displayed instead.

Image 05: Online help uses markdown, which allows decent formatting and simple creation. Lazy Admin Scripts Page Screenshot

Running commands

The major function, which is what Lazy Admin is built for. Executing commands takes you through multiple steps, we will explain each one of them below.

Input parameters

The first dialog is started by clicking the Launch button. You will be greeted with dialog containing form, which prompts for all parameters defined by command's definition.

This dialog may contain 3 different parts.

  • If command uses any online services, which require login prior to command execution, buttons are displayed on top of the dialog window. After you click on the button, login command is executed and button turns green.

#c5f015 Note: Lazy Admin does not check whether you actually logged in or not, that's up to you. If login fails, you can click the green button again and login command is executed again.

Image 06: Input dialog with unclicked Az button and clicked Test button. Lazy Admin Scripts Page Screenshot

  • If running workflow command, previous parameters are displayed as readonly. If multiple results were selected, you can paginate between them.

#c5f015 Note: Commands may also join previous results to single string, resulting in single parameter input.

Image 07: Multiple parameters can be paginated with arrows on bottom of the dialog. Lazy Admin Scripts Page Screenshot

  • If any parameters are defined, form inputs are displayed based on parameter type. There are currently seven input types.
    • String
    • Number
    • ScriptBlock
    • Switch
    • Boolean
    • Select
    • Multiselect

#c5f015 Note: Detailed information about parameter types can be found on Scripts Definitions Files.

Image 08: Sample command with all of the possible input types. Lazy Admin Scripts Page Screenshot

Parameters format

We recommend to always use raw values where possible, without quotation marks or any types of parenthesis. Quotation marks and other formatting should be done via parameters Format attribute, which encloses your value with defined text.
You can always view parameter's format via ℹ icon. Additionally you can view entire command before execution in confirm dialog. Confirm dialog can be toggled in Settings.

Switch vs Boolean

The most confusion may arrise when deciding when to use Switch and when to use Boolean. For that reason, we will explain behaviour of those two parameters here.

Switch is supposed to work well with switch parameters. When Switch is toggled to:

  • right (active) - It is evalued by javascript as object with true value, which passes 'true' string to command processor and applies parameters format.
  • left (inactive) - It is evalued by javascript as object with false value, which means it won't pass any value and this parameter won't be displayed in resulting command.
  • middle (default) - Middle position is in switchs case same as left value. It is default value of toggle button, but it cannot be reached once you click this button at least once.

Boolean is supposed to work with parameters where you may be interested in passing value even when its value is false. When Boolean is toggled to:

  • right (active) - It is evalued by javascript as object with true value, which passes 'true' string to command processor and applies parameters format.
  • left (inactive) - It is evalued by javascript as object with true value, which passes 'false' string to command processor and applies parameters format.
  • middle (default) - It is evalued by javascript as object with false value, which means it won't pass any value and this parameter won't be displayed in resulting command.

#c5f015 Note: If you have any questions, we recommend you to head to Examples page to learn more.

Confirmation

When you press Launch button on parameters dialog, you may be presented with Confirmation dialog, which allows you to think again about your intention and review full command before you actually run it.

There are two options, which can force you to view Confirmation dialog.

  • Developers can include in their command's definition alwaysConfirm parameter, which forces you to view this dialog no matter what.
  • Users can toggle in their Settings to Always require confirmation before script execution to display confirmation dialog no matter what.

#c5f015 Note: If command is too long, you can use Shift + Mouse Wheel Scroll within code block to scroll horizontally.

Image 09: Confirmation dialog, which displays entire command as it will be inserted to PowerShell console. Lazy Admin Scripts Page Screenshot

Execution

When you press Launch either on Parameters dialog (if confirmation is not enforced) or on Confirmation dialog, your command will start executing.

Cancel command

You can always cancel command anytime by pressing Escape. Be wary though, entire PowerShell process will be killed and started again. The only thing, which will be recreated will be CredentialObject and PowerShell session with your alternate credentials. If previous commands stored any state to variable within current PowerShell session, it will be lost after cancelling.

Progress

Lazy Admin can also display console output during execution, which is displayed on the background. Similarly to Confirmation dialog, there are two ways to show progress dialog.

  • Developers can include in their command's definition progress parameter, which forces you to view progress dialog no matter what.
  • Users can toggle in their Settings to Always display script progress. to display progress dialog no matter what.

#f03c15 WARNING: Displaying progress may sometimes cause Lazy Admin to not register end of commands execution, which results in loading spinner to spin infinitely. If that happens, press Escape to cancel command. Use this function with caution.

Image 10: Progress spinner with progress text on bottom of the window. Lazy Admin Scripts Page Screenshot

Results

After the command has finished executing, results dialog will be displayed.

Results may be displayed in two formats.

  • If Lazy Admin manages to parse results as JSON object, it will be displayed in table view, which can be exported to CSV file.

Image 11: Table view of returned values. Table may be filtered and reordered to help you break down results. Lazy Admin Scripts Page Screenshot

  • In all other cases, results will be displayed in their raw form as they were retrieved from PowerShell console.

Image 12: Raw view of returned values. Lazy Admin Scripts Page Screenshot

If the command is part of workflow, you will see large Arrow button on bottom, which takes you to next step of workflow.
If workflow expects parameters from current results, you will be able to check values in table of results.

Image 13: Results table in workflow. You can check certain values and press Arrow button to progress to next workflow step. Lazy Admin Scripts Page Screenshot

After reading all of what Scripts page has to offer, you are mostly set to start using Lazy Admin. If you want to continue reading, you should head over to Settings Page to learn about various settings you can configure in Lazy Admin.

Clone this wiki locally