Make Powershell Prompt for Input

Hello,
I'm would like to make some scripts for some of the more common task that I do daily and I was wondering if there is a way to make powershell prompt for input when needed. For example:
Get-Mailbox -Identity | Get-MailboxStatistics | Sort TotalItemSize -Descending | FT displayname, totalitemsize, itemcount, database, -AutoSize
In this script I would need to be able to run it for any user in our company. Is there a way for me to be prompted for the 'Identity' in this script?
Additionally, for another script is there a way to have multiple points where I'm prompted for input. Example:
Add-MailboxPermission -Identity -User -AccessRights FullAccess -InheritanceType All
Would I be able to be prompted for both the 'Identity' and the 'User' input?
Thanks in advance

Hi,
Use Read-Host:
$identity = Read-Host 'Enter the Identity username'
$user = Read-Host 'Enter the User username'
http://ss64.com/ps/read-host.html
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing)

Similar Messages

  • How to make a form for input in web interface builder

    Hi expert:
        How to make a form for input in web interface builder?I have already used it to do PS planning, but I don't know how to  draw lines and checkboxes . Thanks in advance.
    Allen

    WAD:
    Open the WAD and create a new template. On the left hand navigation you will have several Web Items available. Under 'Standard' you have 'Analysis' item. Pull that into your template to the right. Under the Properties tab you need to pick the query [form/layout] that you have built in Query Designer.
    You will also find other items such as Button group, Checkbox, drop down, list box etc available. Pick and drag into the template whatever it is you require. Lets say you want a button. Under the Properties tab select the 'Command' that you require. You could use standard commands that are available there. You could also define functions and commands that you require.
    Query Designer:
    Open the QD and drag the characteristics and key figures that you require into the rows and columns of the QD. You would need to specify restrictions under the Filter tab of the QD based on the granularity of data that you require. You would need to remember that the key figures need to be made Input Ready [do this by clicking on KF and on the planning tab select "change by user and planning functions"].
    This shouldgive you a start. After you've explored it yourself a bit we can discuss further and I can certainly provide you additional details/material on these areas.
    Srikant

  • Query not prompting for input

    Hello,
    I am just learning Oracle and I am having problems getting a query to run correctly. I am creating a query on the HR database that should prompt the user for input. The code I have so far is below using the single ampersand substitution variable. When I run the query, I keep getting no data found instead of being prompted to enter a letter. I have also tried running the query using a ':' instead of an '&' and get the same results. If I change '&ltr%' to 'A%' the query will run, however I need it to prompt the user to input a letter. I have also tried to run the query without the single quotes, it will prompt for input and return an error of ORA-00911: invalid character. Any help given will be greatly appreciated.
    SELECT last_name, first_name, job_id, department_id
    FROM employees
    WHERE last_name LIKE '&ltr%'
    ORDER BY last_name;

    If you are the sql query form in APEX, try using this query:
    SELECT last_name, first_name, job_id, department_id
    FROM employees
    WHERE last_name LIKE :ltr
    ORDER BY last_name;For input include the % at the end of your string
    When looking for employees with last name like MILLER, enter MILL%
    Thank you,
    Tony Miller
    LuvMuffin Software
    (281) 871-0950

  • Prompt for input from PL/SQL script.

    I have PL/SQL script running in SQL*Plus. I need to prompt for user initials (all users log-in with the same username) and make those initials part of the script.
    How do I do that?
    I know how to do it for SQL script:
    ACCEPT X PROMPT 'ENTER X: '
    select ....
    where column1 = '&X'
    But what about PL/SQL?
    Thanks a lot.
    -John

    PL/SQL is not interactive, so you can't prompt from it, but you can pass parameters :
    TEST@db102 SQL> set veri off
    TEST@db102 SQL> get inp
      1  declare
      2     p_inp   varchar2(100);
      3  begin
      4     p_inp := '&1';
      5     dbms_output.put_line(p_inp);
      6* end;
    TEST@db102 SQL> @inp PM
    PM
    PL/SQL procedure successfully completed.
    TEST@db102 SQL>                                                              

  • Get-mailbox | search-mailbox prompt for input

    I am pretty new to building PS scripts, but I was hoping someone could point me in the right direction. I am trying to get the below script to prompt me for the following input.
    -searchquery
    -TargetMailbox
    -TargetFolder
    get-mailbox -ignoredefaultscope -resultsize unlimited | search-mailbox -domaincontroller "ENTERFQDN" -searchquery 'attachment:"promptedforinput" -TargetMailbox "promptedforinput" -TargetFolder "promptedforinput" -logonly
    -loglevel full

    If I'm correctly understanding your post, I think you could do something like this. You might want to name your variables something else :)
    $var1 = read-host "Search query"
    $var2 = read-host "Target mailbox"
    $var3 = read-host "Target folder"
    get-mailbox -ignoredefaultscope -resultsize unlimited | search-mailbox -domaincontroller "ENTERFQDN" -searchquery 'attachment:$var1 -TargetMailbox $var2 -TargetFolder $var3 -logonly -loglevel full

  • Best way to make program wait for input from NI USB 9162?

    Hi, I'm somewhat new to Labview, but through all the tutorials and online help I'm still having trouble getting this to function properly.
    The USB adapter is hooked up to a network cable split into single wires reading in a voltage coming through several seperate oscillators.  
    Testing in the lab, the program included below works fine when I run the program, then quickly administer a shock to the table.  In the real world scenario though, I'm trying to make the program wait to record data until the first shock reaches the first oscillator before recording data, but I just can't seem to find an easy way to make this work.
    Attatched is an example of the program.  Any help would be greatly appreciated.  Thank you. 
    Attachments:
    Acq&Graph Voltage-Int Clk-rh-tt-1.vi ‏56 KB

      Hi,
    I think I have the answer you're looking for! Please see the attached VI.
    I moved the graph indicator inside the "true" case of the case structure. Before, your VI was sending data  to the graph from an empty timestamp constant with each iteration of the "false" case. Now the VI only sends data to the graph if a true is read.
    If you're wondering why it takes a bit of time for your graph to stop updating before it stops writing new data, it's because you're filling up a buffer of sampled data by using a queue. If you're writing to the buffer faster than you're reading from the buffer, you may encounter an "overflow" situation when the queue gets full. To avoid this, you might consider using a notifier rather than a queue. It's the exact same thing as a queue, but it gives you only the most recent value, allowing new values to overwrite old values.
    Hope this helps.
    Regards,
    Dan Richards
    Certified LabVIEW Developer
    Attachments:
    producer consumer DAQmx threshold.vi ‏57 KB

  • EEM menu not prompting for input

    Hi, I have the following EEM menu, I can't work out why it doesn't wait for my input, either 1, 2 or 3 and just runs though.
    event manager applet menu
    event none
    action 0   puts "  ****************************Menu***************************"  
    action 1   puts "  *                                                                           *"
    action 2   puts "  * Please select an option below :                             *"
    action 3   puts "  *                                                                           *"
    action 4   puts "  * 1 Option A                                                          *"
    action 5   puts "  * 2 Option B                                                          *"
    action 6   puts "  * 3 Option C                                                          *"
    action 7   puts "  *                                                                           *"
    action 8   puts "  ***********************************************************"
    action 9   gets opt
    action 10  if $opt eq 1 goto 800
    action 11  if $opt eq 2 goto 900
    action 12  if $opt eq 3 goto 950
    action 800 puts "Displaying 802.1x stats"
    action 801 cli command "sh dot1x all summary"
    action 802 puts "$_cli_result"
    action 803 exit
    action 900 puts "Please enter the interface to remove 802.1x from"
    action 901 gets opt
    action 902 cli command "enable"
    action 903 cli command "conf t"
    action 904 cli command "interface $opt"
    action 905 cli command "No authentication port-control auto"
    action 906 exit
    action 950 puts "Please enter the interface to apply 802.1x to"
    action 951 gets opt
    action 952 cli command "enable"
    action 953 cli command "conf t"
    action 954 cli command "interface $opt"
    action 955 cli command "authentication port-control auto"
    action 956 exit
    Thanks

    The first problem you have is that your labels are sorted numerically, not in lexicographical order.  You will need to renumber actions 0 through 12 as 000 through 012 respectively.  Finally, consider adding a longer maxrun and default time to this policy since the user may not answer immediately:
    event none maxrun 120 default 120

  • Cannot make os to prompt for password on every mount of enc image

    Even though I specifically tell keychain or whatever not to remember my pass the only way to make it prompt for disk image pass is to logout and log back in
    This is after I use a bash script to both copy files to the image and unmount it

    Even though I specifically tell keychain or whatever not to remember my pass the only way to make it prompt for disk image pass is to logout and log back in
    Where are you specifying this?  Is it only when you attempt to mount the image?
    When you created the disk image, presumably using Disk Utility, did you also uncheck the checkbox for remembering the password in the keychain when you originally created the password for the image?

  • Report sometimes prompts for database logon prior to execution

    I have installed the Crystal Reports Integration Addon on our system and it works correclty for users on our terminal services server.  But when I installed it on a user's PC running Windows XP, when I go to execute an existing report, the Runtime viewer launches, and then displays a Database logon panel with the Server field filled in, the database field is blank, and the SA user and password fields are populated, and I get an error that says logon failed.  I type in the SA user id and password, but get the same error.
    If the same user logs onto the TS server, the runtime viewer launches correctly and the report prompts for input, then displays the appropriate data (no database logon is requested). But if it runs at that user's workstation, the viewer launches, and then prompts for database logon.
    We are running SAP 2007A SP00 PL47, CR Basic 2008 for SAP Business One, and the runtime viewer is Crystal Reports 2008 Runtime SP1. version 2.0.0.7

    Hi Bruce,
    I am not sure what the problem is.
    The only workaround I can think of is to change the Integrated Security in the report to true. This means that you will be using Windows Authentication as opposed SQL Authentication. This will not prompt for SQL username and password.
    Usually this is NOT an ideal process as you will have to Add each and every Windows user in the SQL Database you are trying to access. For example, you have to add DOMAIN_NAME\User_Name under the Database Properties.
    I am not sure what the minimum security you need to run the report. You will try a few different options and see what works best for you. Avoid permissions that would give users ability to write to the SQL database.
    Again, I know this is not ideal. But I am not sure what else can be done here.
    Krishnan

  • Prompt for username

    Im trying to use Safari on windows to sign into a website that uses basic authentication. The first time i log into the site, it prompts me for a username and password. If I close the browser, relaunch it, retype the address and click the login link, it doesn't prompt me for a password and sign me right in. I am NOT marking the remember password option not does a password entry appear in the browsers auto fill preference. The Internet Options for the machine via the control panel) is set to prompt. The only way ive been able to fix this is use the browsers Reset Safari option to erase my password. How can i make Safari prompt for a username and password?

    Thanks, Steve!
    A possibility (that I haven't been able to confirm yet) is that Safari might be interpreting some of these site log ins as "other forms". In that case, the offending password might be stored in a different location.
    Head back into the Autofill tab and click the Edit button next to "Other forms". Does an entry for the website in question show up in your list there? If so, try deleting that entry.
    With the entry deleted, try heading back to the site. Do you get prompted this time around, or is it another automatic log in?

  • I cannot download an app from the app store, it keeps loading until it says "You have already purchased this app so it will be downloaded no at  no additional charge", and then it prompt for password and I input it after which nothing happens.

    I cannot download an app from the app store, it keeps loading until it says "You have already purchased this app so it will be downloaded no at  no additional charge", and then it prompt for password and I input it after which nothing happens.
    I know my icloud has record of my installing this app before, but that was the first install that was failed during that time some other apps also keeps loading without respond whey they updated itself, and this app didn't install before I restart the device. But I don't see this app on my device after I restarted the device so it should have been installed on my device. It seems icloud has created some kind of dead loop that makes it not able to get the correct status about this app on my device.
    I have no problem install this app on my other device (iPad) with the same account, but just fail on my iPhone. And it just fine installing other apps...... What happened !!?? @@
    Please help !!! 

    Someone help! I dont know how to do this and please put the words into an easy way to understand because im young...

  • Make System.in read input from a command prompt

    How can i make System.in read input from a command prompt which is opened after program
    is started. Please note that program starts without commad promt. Can u plz help?
    sharmila

    System.in DOES read from the command shell that you start the app in.
    What you don't have is a prompt.
    You should know about Java Almanac. There are code samples for simple things like I/O that everyone should know about. There's an example there to help you.
    MOD

  • Increasing max # of inputs on prompt for user input

    Hi
    I would like to increase the number of inputs beyond 10 available on the prompt user for input function. At the moment I am using 9 of the 10 available inputs each running a subVI from a case structure. I seem to be limited to 10 inputs using the prompt user for input function so is there another way of prompting the user to select from >10  inputs preferably 20. 
    Thanks for any help
    Chris
    Solved!
    Go to Solution.
    Attachments:
    WASP dialog.vi ‏57 KB

    You can always write you own dialog with as many selections as you like.
    Right-click the express VI and "open front panel" This will convert it to a VI that you can edit in any way you want. save it under a new name.
    You might even want to add some validation code, e.g. to make sure that no more than 2 boxes are checked.
    LabVIEW Champion . Do more with less code and in less time .

  • How to make dyn/admin not to prompt for username and password?

    Hello all
    How to make dyn/admin not to prompt for username and password? I am writing a selenium job to automate cache invalidation to load test a production issue we are facing. Selenium is opening a fresh firefox session and prompting for username and password every time. I am also trying to modify my script such that it will use the same session again and not prompt for username and password. But I thought of asking this question in the group.
    Your inputs will help a lot.
    Thanks,
    Sundar

    Hi,
    You can set enabled property of /atg/dynamo/servlet/adminpipeline/AuthenticationServlet/ to false. It will not prompt for authentication.
    Gopi

  • ExpressVI prompt user for Input dialog floating

    I am using ExpressVI "prompt user for Input". The question is, when the dialog window pops up for input, I cannot activate other windows .
    So how can I change this expressVI's dialog window to floating windows appearance?

    Short answer: you have to make your own.
    You can start with the Express VI by right-clicking on the express VI and selecting "Open Front Panel" and click "Convert". This will create a brand new VI that is the equivalent of the Express VI. Save the VI under a new name within your project hierearchy, and then change the properties on the VI from a modal to a floating:
    Select File->VI Properties.
    Select "Window Appearance" from the pulldown menu.
    Select "Custom" option and click "Customize...".
    Select "Floating" in the "Window Behavior" section.

Maybe you are looking for

  • How do I set an event to repeat on the first tuesday of each month?

    I am trying to set ical for a recurring event, but do not see an option.

  • IOS 6 no longer able to download

    I just upgraded from iPad 3 to 4 and am no longer to download/install new wallpaper from the App Store. 

  • "Transfer process" in BW 7.0

    Hello everybody     Does anybody have any information about what it is called as a "transfer process" in BW 7.0?  We would like to know how to launch a "transfer process" or how to manage it or whatever. I don't know anything about this subject, and

  • FM to get Plants assigned to a company code

    Hello All, Can you please give me the Function Module name where I can give the Comapny code as input and output should be the plants assinged to the given company code. Ofcourse, I have the table V_T001K_ASSIGN but i want FM. Thanks in advance. Best

  • How to remove 3D view in Maps?

    How do I remove the 3D view from Maps so that it STOPS accidentally switching to the extremely pathetic and annoying 3D view EVERY TIME I try to zoom in?!