Automatically Generate PS Scripts

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 7 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
josefgibson
Posts: 4
Last visit: Wed Sep 14, 2016 9:46 pm

Automatically Generate PS Scripts

Post by josefgibson »

Hi All

I was wondering if it was possible to record what I was doing in the windows GUI which in turn will automatically generate PowerShell scripts of the tasks .

Please note I'm not looking for the transcript option. I just want to record everything I do within the GUI that can then be recorded and scripts generated.

Many Thanks
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Automatically Generate PS Scripts

Post by jvierra »

Well no. You can record everything and then edit the recording using "Start-Transcript" to log all activity.
User avatar
josefgibson
Posts: 4
Last visit: Wed Sep 14, 2016 9:46 pm

Re: Automatically Generate PS Scripts

Post by josefgibson »

Thanks for your quick response. :

My understanding was the transcript option records everything you do in PS command line but not using the GUI. I'm More than happy to be wrong :)
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Automatically Generate PS Scripts

Post by jvierra »

What GUI? ISE? Why wouldn't it work with ISE? Have you tried it?
User avatar
josefgibson
Posts: 4
Last visit: Wed Sep 14, 2016 9:46 pm

Re: Automatically Generate PS Scripts

Post by josefgibson »

Hey

I want to record things I do when working within the Windows 2012 GUI. Example being making configuration changes using mouse and opening the window I want to change the settings for.

It would be cool if I could record the changes I'm making within the windows GUI and then spitting the raw PowerShell with the full syntax I need to do this by a script .

This would save a lot of time writing the scripts from scratch and researching the objects and methods I need to use to make the changes.

An example of this is in IIS,

When using the configuration editor in IIS you can click the generate script option after you have made configuration changes.

This then gives you a 5 ways to do the configuration using code such as c#, scripting like JavaScript and PowerShell. The tool provides the full syntax to achieve that goal. You can then just copy that code and add it to a script etc So its really quick and accurate
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Automatically Generate PS Scripts

Post by jvierra »

Windows has a recorder that can record you sessions. We don't support that her.
There are many third party applications that will record you keystrokes and mouse clicks.

Your request seems to have little to do with scripting.
User avatar
josefgibson
Posts: 4
Last visit: Wed Sep 14, 2016 9:46 pm

Re: Automatically Generate PS Scripts

Post by josefgibson »

I'm not trying to record key strokes I'm trying to record the underlying PowerShell commands and functions that are being called when working in the GUI. Nearly everything u do in a window is calling a PS scripts and commands in the background.

Anyway no worries thanks for taking the time replying to me. It's Much appreciated :)

Kind Regards
Joe
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Automatically Generate PS Scripts

Post by jvierra »

Use a transcript. I cannot suggest anything better.
User avatar
jewver
Posts: 21
Last visit: Sun Jan 28, 2024 11:24 pm

Re: Automatically Generate PS Scripts

Post by jewver »

Hi,
perhaps

UI Automation PowerShell Extensions
uiautomation.codeplex.com
or
github.com/apetrovskiy/STUPS

is something you can use.
This topic is 7 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked