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

Similar Messages

  • 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)

  • 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

  • Exchange 2010 mailbox prompts for authentication to Exchange 2013 mailbox

    I am in the process of a 2010 to 2013 migration. The only issue I can't seem to manage is an authentication issue with Outlook 2010. My Outlook profile consists of my Exchange 2013 mailbox and a shared mailbox on Exchange 2010. Initially, Outlook was prompting
    for authentication to the Exchange 2010 mailbox. Regardless of whether I entered the correct credentials or simply cancelled the prompt, I still had full access to both mailboxes (including Public Folders on 2010). The authentication prompt was removed with
    the following command:
    Get-OutlookAnywhere -Server my2013exchserver | Set-OutlookAnywhere -InternalClientsRequireSsl $true
    The second issue I now have is the reverse of the above: an Exchange 2010 user is prompted for authentication to an Exchange 2013 mailbox. How do I begin to troubleshoot this problem - should I run the same command (above) on 2010? I don't quite understand
    how Outlook communicates with Exchange but I am thinking there is an incorrect setting on one of the Virtual Directories(?).
    Many thanks.

    Hi Dennis,
    Please open Outlook - press CTRL key - right click on the Outlook icon from right bottom corner taskbar –Connection Status to check the connection for your Exchange 2010 mailbox with shared 2013 mailbox. The following example in my test results:
    Please check your connection authentication. We can  run the following command to set your Outlook Anywhere for Exchange 2013:
    Set-OutlookAnywhere -Identity "E15-01\Rpc (Default Web Site)" -InternalClientAuthenticationMethod Ntlm -ExternalClientAuthenticationMethod Basic -ExternalClientsRequireSsl $True -InternalClientsRequireSsl $true
    In Outlook side, please ensure the following settings in Account Settings:
    In Security tab, make sure Always prompt for logon credentials is unchecked and Logon network security is set to Negotiate Authentication.
    Regards,
    Winnie Liang
    TechNet Community Support

  • 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>                                                              

  • Drag and drop songs gets a search box looking for autoplay

    Hi,
    All of a sudden I'm having problems with my shuffle. I reset to default factory settings hoping that would help, but no luck. When I drag songs into my shuffle a windows search box (with the flashlight) pops up and it's searching for "autoplay". Itunes indicates it's updating my shuffle with the songs I'm adding, but when I play my shuffle there is absolutely nothing on it. Went through the 5 R's to resolve the problem and got stuck on deleting the ituneshelper.exe folder - told I was denied access. At a loss as to what to do now except buy the new generation shuffle! Thanks for any help.

    Itunes indicates it's updating my shuffle with the songs I'm adding, but when I play my shuffle there is absolutely nothing on it.
    hmmm. it might be worth checking to see if you're getting a version of the issue described in the following document:
    Windows confuses iPod with network drive or hard drive and may keep iPod from mounting or songs may seem to disappear

  • 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

  • Getting the result ALV ready for input to be able to maintain the result

    Hi guys,
    i did follow and implement this program to mass maintain variables in a broadcasting setting and save the new values back.
    The program allows maintenance of infoobjects or variables via the selection screen. What i want to have is just to select a or many broadcast settings. After executed i can see all infoobjects, variable names and variable values in an ALV. The values for the variables used in the broadcast settings all begin with var_value then the value of that variable.This is the value i want to change therefore i need to have all fields after var_value input ready and maintainable there.
    How can i get these field editible?
    The thing is that the ALV result looks like
    Var_name_1 name of variable 1
    Var_name_2 name of variable 2
    Var_name_3 name of variable 3
    ... so on till all variable names are listed in rows
    Then further below the all the variables get their value.
    Var_value_1 value for the variable_1
    Var_value_2 value for the variable_2
    Var_value_3 value for the variable_3
    ... so on till all variables have their value.
    All these rows are not editable as a result of ALV. I want the Var_names be not editable as it is now but i want the Var_value fields be editable so we can change them in the ALV result and save them back.
    How can i do this approach?
    Any help, idea, hints appreciated.
    Thanks and kind regards,

    This issue is solved.

  • How to get current language bar setting for input language

    I am using Flex Builder 3, IE 7 and windows OS. Is there a
    way to determine the current input language as set in the "language
    bar"? The Capabilities class always returns "en" even after I set
    Chinese ("ch") as my input language.

    Hi Dragon Cao,
    No need to create any customer exit variable for this ..
    You have standard variable CMONTH this displays current month summation. Just restrict your Key figure with this variable.
    And in properities of Key figure goto Calculations> Local Calculations> select Summation.
    If you want to assign some calday at run time sure you need to create customer exit variable using Step_2 value in enhancements(CMOD).
    Regards,
    Rajeswari.
    Edited by: mrajeswari on Aug 24, 2011 12:35 PM

  • Can NOT get voice search to work for sms

    when i say "send text to reciepient how are you peter?"
      the entire command goes in to the message OR it brings me to a google search.  What I want to do is have it send a message to someone in my contact list

        Hey gailga!
    I am sorry that you are having problems with your voice to text function. I know that I love that feature! Actually, you can find out what exactly to say and how to say it by touching the small ? at the bottom right when you initiate S Voice. For example, for texts, all you have to say is "Text (contact name) message. What's up?" And it will create a new text to your contact name with what is said after the word "message." Find out about more things that you can do in the small ? at the bottom. I would make sure that you speak clearly because the default for anything S Voice can't understand is to do a Google Search. Happy texting!
    MichelleG_VZW
    Please follow us on Twitter @vzwsupport

  • I get zero search results even for items I know are at the store. Anyone else getting this behavior?

    On two different machines, one running Snow Leopard, the other running Yosemite, iTunes does not display search results for most searches, including items that I know are at the store. I'm just wondering if anyone else has experienced anything similar?

    Yes.  I find that I have to revise my search several times to finally find what I want.  If I can't find it under the artist, I might find it under the title of the song, or some variation of the title.  It seems to be more common with older songs or movies.  This has been true even before the current update.  Case in point, recently I couldn't find a song I wanted under the artist's listing.  I searched under the name of the song, and not only found the song, but also some albums that hadn't been listed under the artist in my first search results.

  • 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

  • ADF security - prompt for user id and password again on page forward

    Hi,
    I am working with ADF using JDeveloper 10.1.3 with Business Components and ADF Faces.
    I have a Search page and a List page.
    Both pages are based on the same view within the same application module.
    The Search page is using the default Find and Execute Operations.
    The Execute button has an action that navigate to the List screen.
    faces-config.xml
    <navigation-rule>
    <from-view-id>/jspx/search.jspx</from-view-id>
    <navigation-case>
    <from-outcome>search</from-outcome>
    <to-view-id>/jspx/list.jspx</to-view-id>
    <redirect/>
    </navigation-case>
    </navigation-rule>
    <navigation-rule>
    <from-view-id>/jspx/list.jspx</from-view-id>
    <navigation-case>
    <from-outcome>find</from-outcome>
    <to-view-id>/jspx/search.jspx</to-view-id>
    <redirect/>
    </navigation-case>
    </navigation-rule>
    Security (Roles and Users) is based on the jazn-data.xml and web.xml
    URL Patterns for the pages have assigned to the role.
    Login Configuration is HTTP Digest Authentication
    <web-resource-collection>
    <web-resource-name>APP_SUPPORT</web-resource-name>
    <url-pattern>faces/jspx/search.jspx</url-pattern>
    <url-pattern>faces/jspx/list.jspx</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>APP_SUPPORT</role-name>
    </auth-constraint>
    <login-config>
    <auth-method>DIGEST</auth-method>
    </login-config>
    Everything is fine when running the application from JDeveloper,
    but when the application is deployed to the server (OC4J),
    After logging into the system, the Search page prompt for user id and password again
    on click of the Execute button.
    Have anyone experience this problem before?
    Thanks for any help.
    Jim

    Hi,
    does the same thing happen if you change your protected resource from:
    <web-resource-collection>
    <web-resource-name>APP_SUPPORT</web-resource-name>
    <url-pattern>faces/jspx/search.jspx</url-pattern>
    <url-pattern>faces/jspx/list.jspx</url-pattern>
    </web-resource-collection>to:
    <web-resource-collection>
    <web-resource-name>APP_SUPPORT</web-resource-name>
    <url-pattern>/faces/jspx/*</url-pattern>
    </web-resource-collection>Brenden

  • XI: Alerts - Step by step issue " Prompt for customizing request"

    I am going through Michal Krawczyk's blog XI: Alerts - Step by step
    Michal Krawczyk and between step 4 and step 5 I run up against an issue.  I cannot save it because I get a popup saying "Prompt for customizing request" then I click the list button and it says " You can only include objects of this type in customizing requests only" ( a little redundant I must say ) but anyway - the net result is I can't save and lose all the work I just did.
    Any help would be greatly appreciated!
    Thanks - Andrew

    Scott,
    I have replied in your another thread for this issue. I request you to please make one thread only so that it will not confuse you and the SDNers.
    ---Satish

  • Outlook Password prompt for Linked Mailboxes from certain Domain

    Hello,
    As part of a migration project, I'm trying to connect Outlook with Linked Mailboxes from users in a trusted domain.
    I'm able to create the linked mailbox on the Exchange 2013 (CU7) server without any issue, but when I try to configure Outlook for these mailboxes, it is prompting for credentials permanently and won't start. Log on to OWA with the same user from the trusted
    domain is working fine.
    I'm able to configure Linked mailboxes from another trusted domain without any problems.
    I've already recreated the trust between these two domains (validation tells everything is ok)
    DNS is configured with conditional forwarders in both domains and name resolution looks ok to me (ping and nslookup)
    When I look at the LinkedMasterAccount of the mailboxes from this domain, I can see that there is only the SID (S-1-5-21-4033829......). The other linked mailboxes (from the other domain where it's working) are showing the Account name (domain\user)
    Internal and External ClientAuthenticationMethod of OutlookAnywhere is set to NTLM
    Infos:
    DomainA: Domainlevel 2012 - Exchange 2013 - Forest trust to Domain B and C
    DomainB: Domainlevel 2008 - Exchange 2010 - Forest trust to Domain A - Outlook for linked Mailboxes of DomainA works fine
    DomainC: Domainlevel 2008 - Forest trust to Domain A --> can't connect Outlook to LinkedMailboxes of this domain.
    Is there anything else I can check?

    Hi,
    Please check whether the server is configured to only accept NTLM version 2 and reject NTLM and LM, and the Outlook client computer is not configured with the same LAN Mananger authentication level.
    Check DC, Start -> Programs -> Administrative Tools -> Security Options -> Note the LAN Manager authentication level.
    Check DC's policies, Start -> Programs -> Administrative Tools -> expand Security Settings\Local Policies -> Security Options -> Note the Lan Manager authentication level.
    IMPORTANT: You may also have to check policies that are linked at the site/domain/organizational unit levels to determine where the LAN Manager authentication level must be configured. Configure the LAN Manager authentication level to "Send
    NTLMv2 response only". If you want to implement NTLM version 2 in your network, make sure that all computers in the domain are set to use this authentication level.
    Thanks
    Mavis Huang
    TechNet Community Support

Maybe you are looking for

  • RMA'ing GPU due to leaking fans

    I have two R9 280X Gaming cards that are suffering from leaking fans and noisy bearings. As far as I know (see quote below from MSI employee) this is a well known issue and the solution seems to be to RMA them to MSI for replacement. However that's p

  • Help! Im about to throw the compter through the window

    AHHHHHHHHHHH! Ok, Ive been working on fixing this problem for the past 2 days. Im so frustrated. I started by upgrading to 6.0, first, it worked, then it stopped working. Now I get an error about quicktime. Its basically saying I have the wrong versi

  • The packager for iphone is slow !!!solution!!!

    i've build a couple of apps ,, at first i thought my computer is running slow and that's why the apps are running slow on my iphone but then  saw everyone is actually complaining through out the internet We need a soultion to this problem i think we

  • HELP !!! - sql script to find free space in Oracle7,8,9 DB

    Hi All I got a PL/SQL script to find out free space in Oracle7,8,9 db. But because in Oracle 7 there is no maxbytes column in dba_data_files, so this script is not working. I am trying to use cursor and putting sql in a variable so that when program

  • Classement et disque dur

    Dans Element, je crée des album pour classer mes photos, je crée même des catégories d'albums  dans lesquels je place mes albums. En gros j'organise et je classe tous mes documents photos. Mais dans explorateur window (après avoir sauvegarder mon cat