Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Image Processing examples
This example uses PowerShell Universal Dashboard.
This examples accepts a JPEG file and converts to to a PNG using Universal Dashboard. To implement this example, we need to use published folders and a dashboard that uses UDForm and the UDUpload component. After converting the image, it displays it.
This example uses PowerShell Universal API.
This example is similar to the dashboard example but exposes the functionality as an API rather than a webpage. The API accepts a POST request that contains the image as a the body. We use the $Data
variable which contains the byte array for the image file and then convert it use the same method. We then take advantage of the New-PSUApiResponse
cmdlet to return a custom response.
We can invoke the API with Invoke-WebRequest
. The below example posts the IMG_2260.jpeg file and converts it to an image.png file.
This example uses PowerShell Universal API. This example requires a license.
This example provides the same functionality as the previous example but rate limits the number of requests to 5 per 10 minutes. We can use New-PSURateLimit
to set the request limit.
Invoking this request most than the specified number of times will result in an error.
This retro looking dashboard displays the top 10 CPU and memory using processes, disk usage, and live CPU and network usage. It also demonstrates how to use themes to custom the backcolor, text color and font family.
In this example, we take advantage of Universal Dashboard scheduled endpoints, the in-memory cache and the UDMonitor component. We update the counter sets to use in the cache and load each of the counters' value in the set into an array to use in the dashboard. We then create a dashboard that dynamically creates UDMonitor charts within the page. Each monitor will update every 3 seconds with new data.
This example uses .
Hyper-V examples for PowerShell Universal.
This example uses PowerShell Universal Dashboard.
This example can be used to create virtual machines on a Hyper-V host. This dashboard assumes it's being run on the host in question. You could adjust the dashboard script to run on a remote host.
Examples integrating with PowerShell Protect.
This example configures PowerShell Protect to send log messages to a PowerShell Universal instance. It sends HTTP POST requests to the configured server.
This configuration checks to see if the user has included the string \\corp\human-resources
anywhere in their script. If they do, it sends an HTTP POST to the URL http://localhost:8080/protect
The body of the HTTP request will contain the computer name and user name separated by a comma.
This PSU configuration defines an endpoint to accept the POST data from PowerShell Protect. It then saves the data to a file. It also defines a dashboard that will read the data and display it in a table. This assumes that you have installed the PowerShell Universal module and server.
Active Directory examples for PowerShell Universal.
This example uses Universal Automation.
Shows an example of how to list locked Active Directory accounts. This example assumes that the user running PowerShell Universal has access to the local Active Directory environment.
Locked accounts will be listed on the job page's pipeline output.
You can also access the locked accounts by using the Universal PowerShell module.
This example uses Universal Automation.
Shows an example of how to reset an Active Directory user account using PowerShell Universal Automation. This script accepts the identity of the account to reset, the password to set, whether to unlock the account and whether to require the user to change their password on logon.
This account users PowerShell Universal Dashboard and Automation.
In this example, we use Universal Dashboard to create a dashboard that displays a table that includes all the deleted user accounts for the domain. It creates a custom column with a button that includes a Restore button that executes a script to restore the specified account. This example assumes that the identity running the script is capable of accessing Active Directory.
Examples of PowerShell Universal configurations.
We maintain several component libraries that you can use in your dashboards directly or as examples.
This page contains examples of PowerShell Universal configurations. All examples are built using single-file hosting and configuration. These examples assume that you have PowerShell Universal installed. To install PowerShell Universal, use the following command line.
You can login to PowerShell Universal using the username admin
and any password.
Have an example of an API, Dashboard or Script that you think would fit nicely on this page? Feel free to open a pull-request on our .
Active Directory
Hyper-V
Image Processing
Monitoring
Slack
SQL examples for PowerShell Universal.
This example uses Universal Dashboard.
This example takes advantage of a SQL server and the New-UDTable
cmdlet to create a table that retrieves data from a database table. The filtering, sorting and paging take place within the database.
This example assumes that we have a database called podcasts running in the local MS SQL Server. It has a table called shows that includes a column called host and a column called name.
Examples of integrating Slack with PowerShell Universal.
This example uses .
This example uses a custom Slack webhook to send a message from a Universal API.
You can invoke this API by calling Invoke-RestMethod
The following message will show up in Slack.
This example takes advantage of triggers to send a message to Slack when a job fails within PowerShell Universal. We define two scripts. The first script simply throws and error and is set to fail by using the -ErrorAction Stop
setting. The second script receives the job that failed and sends a message to the team's Slack channel.
When the failing script is running, it will report failure in the UI.
Due to the failure, the trigger will execute and send a message to Slack.
Here is an example of the output for the dashboard.
This following example uses . This example requires a .