Jump to content

Powershell Popup box

ziogref

Hi guys, Below is the first line of code in my powershell script

When I run it I want it to have a popup box where I can enter the value for the "AddMonths" field (which below is -5)

So basically I run the script, A popup pops up, I enter that value (in this case -5) and then hit ok, then the -5 would then be put into the "AddMonths" value field and then the script continues to run.

How do I do the pop up box? 

Quote

 

Get-ChildItem -Path "G:\Torrents" -Recurse | Where-Object {$_.LastWriteTime -lt (Get-Date).AddMonths(-5)} | Move-Item -Destination "G:\temp"

#More lines of code below

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

PowerShell is aimed at automating system administrator tasks without any UI need. Its whole design centres around letting domain admins create batches of users, resetting passwords for batches of users, performing silent installs of software etc. all from commands with only a command prompt frontend interface at most (a bit like the old DOS bach files).

 

If you want to have values set when the script first runs, take a look at:

https://technet.microsoft.com/en-us/magazine/jj554301.aspx

http://stackoverflow.com/questions/5592531/how-to-pass-an-argument-to-a-powershell-script

 

If however you want extra UI functionality - popup dialogs, forms, sounds well then PowerShell is likely a bad/wrong design choice to continue with for this - if you post your actual full task you're hoping to accomplish, perhaps we can help suggest the best, or a more preferred way outside of PowerShell to accomplish it then.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×