Remove phonenumber for user in spesific OU

HI all,
not a PowerShell guru,but found that i can run following command to SET officephone for every user in a spesific OU
get-aduser -Filter * -SearchBase "ou=testou,dc=test,dc=net" | Set-ADUser -OfficePhone 555-555-1212
But i want to REMOVE Officephone for all users in a spesific OU instead.What would be the correct command to add?
Thanks!
Please mark as helpful if you find my contribution useful or as an answer if it does answer your question. That will encourage me - and others - to take time out to help you. Thank you! Off2work

Hi o2w,
it is a slight modification of your current example:
get-aduser -Filter * -SearchBase "ou=testou,dc=test,dc=net" -Property OfficePhone | Set-ADUser -Remove @{ OfficePhone = $_.OfficePhone }
Cheers,
Fred
There's no place like 127.0.0.1

Similar Messages

  • Remove encryption for users?

    Hi,
    Is it possible to remove the possibility for users to encrypt documents, both using certificates and password? I am a aware that a combination of removing DigSig.api and PKKlite.api, and setting FIPSMode will do the job. But is it a better way of achieving this?
    -Rasmus

    I removed the beforementioned plug-ins, but unfortunately this interefered with other critical Acrobat plug-ins. I created a pdf with buttons and actions, saved the document and closed Acrobat. When tried to open the document with Acrobat Pro the program would crash. After I reinstalled the plug-ins this behaviour stopped. Do I really have to sacrifice program functionality and reliability to keep my users from encrypting documents?
    -Rasmus

  • Remove personalization for users

    Hi,
    we are running a portal for many thousand users. We have restricted personalization on the portal so that the user cannot personalize anything.
    However after an upgrade, personalization was allowed at some placed for a short while before we removed it. However a couple of users managed to personalize their site, and now we wan't remove their personalization and reset their portal to the default one.
    Does anyone know how to do this.
    Are there table in the DB where personalization is stored.
    We are running EP 60 SP2 Patch 3 hotfix 7 on AIX
    Thanks,
    Mikkel

    In EP5, personalization details was stored in PCD - Database.
    If only couple of users, then you can delete these users when they are not using the portal and recreate the user ids with default portal personalization. This is just a work around, i am sure there will be better option in EP6.
    If you are fine with the work around, give some points.
    Thanks
    Senthil

  • Mailbox cleanup could not completely remove the mailbox for user

    Hello.
    I have Exchange 2010SP3 2 DAG member in cluster.
    Recently i have warning in app log on a second DAG member:
    Mailbox cleanup could not completely remove the mailbox for user GUID.Encountered error 0xfffffae8. Should this message continue to persist for the same mailbox, it may be indicative of a problem that requires further investigation. 
    I read all post wich say just unmount and mount database.
    I can't find any user wich have guid containted in error.
    So that i need to do?
    Can i use StartDAGmaintenance and reboot a server,then after reboot use StopDAGmaintenance?

    Hi,
    I suggest to refer to this blog to find this mailbox by GUID.
    http://blogs.technet.com/b/ehlro/archive/2010/04/22/how-to-find-the-object-that-belongs-to-a-guid.aspx
    Then check which database this mailbox belongs to, dismount and mount this database.
    Best Regards.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
    Lynn-Li
    TechNet Community Support

  • Remove sysdba privilege for user

    Hi,
    $ sqlplus
    SQL*Plus: Release 9.2.0.7.0 - Production on Thu Apr 19 05:57:41 2007
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Enter user-name: / as sysdba
    Connected to:
    Oracle9i Release 9.2.0.7.0 - 64bit Production
    JServer Release 9.2.0.7.0 - Production
    SQL> exit
    Disconnected from Oracle9i Release 9.2.0.7.0 - 64bit Production
    JServer Release 9.2.0.7.0 - Production
    $
    $
    $ id
    uid=5000(webman) gid=103(wbroot)
    $I want to remove "sysdba" connect privilege for user "webman", what do I need to do?
    I am on HPUX
    Thanks

    I tried the revoke command below & I am stiil able to connect as "/ as sysdba" for webman.
    revoke sysdba from webman;These are the users on in the DB.
    SQL> select username from dba_users;
    USERNAME
    SYS
    SYSTEM
    OUTLN
    WEBMAN
    DBSNMP
    SECW
    SEC
    DAEMON
    8 rows selected.
    SQL> select username,granted_role,default_role from user_role_privs;
    USERNAME                       GRANTED_ROLE                   DEF
    WEBMAN                         CONNECT                        YES
    WEBMAN                         DBA                            YES
    WEBMAN                         OT_ADM                         YES
    WEBMAN                         OT_OWNER_ROLE                  YES
    WEBMAN                         OT_SEC                         YES
    WEBMAN                         OT_USR                         YES
    WEBMAN                         RESOURCE                       YES
    7 rows selected.

  • Remove T Code for each ROLE for user

    Hi Experts
    Can anyone tell me how to remove the T code for each role which was define individually for users Eg
    CR01 has been assign to 50 users, the difficulty is I have to go to each role then search for CR01 t code then delete and again generate the Authorization
    In this way there are so many t codes which I have to go one by one to delete it.
    Any help to remove the t-code for each role through any way.
    regards
    Piroz

    try the Security forum at Security
    they might have trick (such as CATT scripts).
    doing this via SQL commands is dangerous. avoid this solution if you are not 100% sure of its impact.

  • Need help with Java app for user input 5 numbers, remove dups, etc.

    I'm new to Java (only a few weeks under my belt) and struggling with an application. The project is to write an app that inputs 5 numbers between 10 and 100, not allowing duplicates, and displaying each correct number entered, using the smallest possible array to solve the problem. Output example:
    Please enter a number: 45
    Number stored.
    45
    Please enter a number: 54
    Number stored.
    45 54
    Please enter a number: 33
    Number stored.
    45 54 33
    etc.
    I've been working on this project for days, re-read the book chapter multiple times (unfortunately, the book doesn't have this type of problem as an example to steer you in the relatively general direction) and am proud that I've gotten this far. My problems are 1) I can only get one item number to input rather than a running list of the 5 values, 2) I can't figure out how to check for duplicate numbers. Any help is appreciated.
    My code is as follows:
    import java.util.Scanner; // program uses class Scanner
    public class Array
         public static void main( String args[] )
          // create Scanner to obtain input from command window
              Scanner input = new Scanner( System.in);
          // declare variables
             int array[] = new int[ 5 ]; // declare array named array
             int inputNumbers = 0; // numbers entered
          while( inputNumbers < array.length )
              // prompt for user to input a number
                System.out.print( "Please enter a number: " );
                      int numberInput = input.nextInt();
              // validate the input
                 if (numberInput >=10 && numberInput <=100)
                       System.out.println("Number stored.");
                     else
                       System.out.println("Invalid number.  Please enter a number within range.");
              // checks to see if this number already exists
                    boolean number = false;
              // display array values
              for ( int counter = 0; counter < array.length; counter++ )
                 array[ counter ] = numberInput;
              // display array values
                 System.out.printf( "%d\n", array[ inputNumbers ] );
                   // increment number of entered numbers
                inputNumbers++;
    } // end close Array

    Yikes, there is a much better way to go about this that is probably within what you have already learned, but since you are a student and this is how you started, let's just concentrate on fixing what you got.
    First, as already noted by another poster, your formatting is really bad. Formatting is really important because it makes the code much more readable for you and anyone who comes along to help you or use your code. And I second that posters comment that brackets should always be used, especially for beginner programmers. Unfortunately beginner programmers often get stuck thinking that less lines of code equals better program, this is not true; even though better programmers often use far less lines of code.
                             // validate the input
       if (numberInput >=10 && numberInput <=100)
              System.out.println("Number stored.");
      else
                   System.out.println("Invalid number.  Please enter a number within range."); Note the above as you have it.
                         // validate the input
                         if (numberInput >=10 && numberInput <=100)
                              System.out.println("Number stored.");
                         else
                              System.out.println("Invalid number.  Please enter a number within range."); Note how much more readable just correct indentation makes.
                         // validate the input
                         if (numberInput >=10 && numberInput <=100) {
                              System.out.println("Number stored.");
                         else {
                              System.out.println("Invalid number.  Please enter a number within range.");
                         } Note how it should be coded for a beginner coder.
    Now that it is readable, exam your code and think about what you are doing here. Do you really want to print "Number Stored" before you checked to ensure it is not a dupe? That could lead to some really confused and frustrated users, and since the main user of your program will be your teacher, that could be unhealthy for your GPA.
    Since I am not here to do your homework for you, I will just give you some advice, you only need one if statement to do this correctly, you must drop the else and fix the if. I tell you this, because as a former educator i know the first thing running through beginners minds in this situation is to just make the if statement empty, but this is a big no no and even if you do trick it into working your teacher will not be fooled nor impressed and again your GPA will suffer.
    As for the rest, you do need a for loop inside your while loop, but not where or how you have it. Inside the while loop the for loop should be used for checking for dupes, not for overwriting every entry in the array as you currently have it set up to do. And certainly not for printing every element of the array each time a new element is added as your comments lead me to suspect you were trying to do, that would get real annoying really fast again resulting in abuse of your GPA. Printing the array should be in its own for loop after the while loop, or even better in its own method.
    As for how to check for dupes, well, you obviously at least somewhat understand loops and if statements, thus you have all the tools needed, so where is the problem?
    JSG

  • Cannot view InfoPath Form on SHarePoint 2013 since I removed SkyDrive for Business and installed OneDrive For Business

    I removed SkyDrive for Business and installed OneDrive for Business on my laptop. After that, I had problems opening a Word and Excel document in a SharePoint site (SP2013). After installing Service Pack2 from Office2010, this problem is solved. 
    But I still have the same problem with InfoPath. Whenever I click an InfoPath form (I have InfoPath 2010 on my laptop),...
    ... I get the error "cannot display web page".
    When I change the URL 
    ms-infopath:ofe|u|http://intranet.water-link.be/samenwerken/awwit/Autorisaties/Gebruikersbeheer/2015-02-25%20Aanvraag%20gebruikersbeheer%20voor%20Stephanie%20Geeraerts.xml
    into
    http://intranet.water-link.be/samenwerken/awwit/Autorisaties/Gebruikersbeheer/2015-02-25%20Aanvraag%20gebruikersbeheer%20voor%20Stephanie%20Geeraerts.xml 
    I can open the InfoPath form and read it.
    Any ideas about how to fix this ? I already tried to restore the Office 2010 via Control Panel - Install Programs but without any success... 

    Hi Gert,
    As I understand, you can’t open InfoPath form in SharePoint 2013 unless you change the URL without “ms-infopath:ofe|u|”.
    There are some reasons which maybe cause this issue, and you can try to do things below:
    Access CA -> General Application Settings -> Configure InfoPath Form Service -> Check the two options in User Browser-enabled Form Templates.
    Go into the registry by typing regedit from the Run line and rename the SharePoint.OpenDocuments.5 key (ex. SharePoint.OpenDocuments.5.old) under HKEY_CLASSES_ROOT.
    In library settings, click "relink documents to this library".
    Here are some similar posts for your reference:
    http://blogs.technet.com/b/office_integration__sharepoint/archive/2014/02/24/quot-the-webpage-cannot-be-displayed-quot-when-trying-to-open-edit-an-office-file-from-a-sharepoint-2013-site.aspx
    http://www.infopathdev.com/forums/t/28998.aspx
    Thanks,
    Wendy
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection

    "[DBNETLIB] Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection"
    After patches applied on patch Tuesday the database reports the above error. 
    All accounts are domain accounts and SQLServer uses Windows auth.
    DCDIAG show no errors
    All servers and DC have been restarted,
    Message in db log confirms the connection is being denied due to trust.
    Event log shows same rejection
    Protocols enabled: named pipes, tcpip, memory
    TESTS:
    PortQry: "
    TCP port 1433 (ms-sql-s service): LISTENING"
    Connect with domain admin accounts works from multiple clients systems to DB.
    Cannot connect with newly created domain admin account
    Can connect if new admin account connect to server in terminal server session and uses UDL wizard or any other tool including isql.
    New standard user also fails to connect.
    NOTES:
    I removed the SSL patch and the IE security update to see if that was an issue.
    ¯\_(ツ)_/¯

    Has someone left the company or has an account of some nature been dropped/replaced?
    Please click "Mark As Answer" if my post helped. Tony C.
    Hi Tony,
    Srry but No.  We just installed the monthly updates.
    I went back and found I had missed removing a patch.  I missed the rollup for Windows Server 2003:
    Event Type: Information
    Event Source: NtServicePack
    Event Category: None
    Event ID: 4382
    Date:  3/12/2015
    Time:  12:26:04 PM
    User:  NETTEST\admin
    Computer: DATA1
    Description:
    Windows Server 2003 KB954920 was removed from your computer, and the previous Windows Server 2003 configuration was restored.
    After I removed that is still didn't work but after about five minutes it started working.
    I guess I ned to report that to MS after I research what might be changed to make the patch work.
    Every time I get stuck and ask for help it seems to be just before I stumble on the solution.
    Thanks for replying.
    Well - maybe this will help someone else.
    Thanks again for replying Tony
    ¯\_(ツ)_/¯

  • How to Use 'uid' for AD Users Without Domain Name For User Log in OAM

    How to Use 'uid' for synchronized Active Directory (AD) Users into Oracle Internet Directory (OID) Without Domain Name For User Logins in OIDDAS and OAM
    We successfully integrated OAM 11g with EBS R12.1.3 Now all the AD user id's stored in fnd_users table as [email protected]
    How can we remove @abc.com
    We are using OID 11g and OAM 11g
    Found the similar note for OID 10G: How to Use 'uid' for AD Users Without Domain Name For User Logins in OIDDAS and SSO [ID 580480.1]
    We are in OID 11g.
    Any help on this greatly appreciated.

    I couldn't find any reference that could be helpful -- Please log a SR and see if this is supported and if the steps are available.
    Thanks,
    Hussein

  • Unhandled Exception Error - Login Failed for User

    Hello,
    I am receiving an error when I run my application stating “Unhandled exception has occurred. If you click continue, the application will ignore the error………..Login failed for MyUser.
    When I click the Continue button the application runs and seems to work properly. This application used to run without receiving the error and I did not make any changes. I have another application that is using basically the exact same code and does not
    receive the error. The only difference is the application is querying a different DB but using the exact same connection string. The error only occurs when I run the exe file created from the build. When I run (debug) the application from within the VS 2013
    IDE I do not receive the error.
    Here are the details to the error message:
    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.
    ************** Exception Text **************
    System.Data.OleDb.OleDbException (0x80040E4D): Login failed for user 'jobrunner'.
       at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
       at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
       at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.OleDb.OleDbConnection.Open()
       at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
       at LoanOrig_FDIC_Codes.DataSet1TableAdapters.I_LoansTableAdapter.Fill(I_LoansDataTable dataTable) in u:\Visual Studio Projects\LoanOrig_FDIC_Codes\LoanOrig_FDIC_Codes\LoanOrig_FDIC_Codes\DataSet1.Designer.cs:line 1668
       at LoanOrig_FDIC_Codes.Form1.Form1_Load_1(Object sender, EventArgs e) in u:\Visual Studio Projects\LoanOrig_FDIC_Codes\LoanOrig_FDIC_Codes\LoanOrig_FDIC_Codes\Form1.cs:line 152
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
    LoanOrig_FDIC_Codes
        Assembly Version: 1.0.0.0
        Win32 Version: 1.0.0.0
        CodeBase: file:///U:/Visual%20Studio%20Projects/LoanOrig_FDIC_Codes/LoanOrig_FDIC_Codes/LoanOrig_FDIC_Codes/bin/Debug/LoanOrig_FDIC_Codes.exe
    System.Windows.Forms
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    System.Drawing
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    System
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.34238 built by: FX452RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    System.Configuration
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    System.Xml
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.34234 built by: FX452RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
    System.Data
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
    System.Data.DataSetExtensions
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Data.DataSetExtensions/v4.0_4.0.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll
    System.Numerics
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
    System.Transactions
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.
    For example:
    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>
    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.
    I'm not sure what the JIT debugger is but to my knowledge my other apps are not using that. The production username and password are correct in the connection string so I'm not clear why I am receiving this error especially since I'm not receiving the
    error on my other application. I have also attached the code just in case it is needed. Any assistance will be greatly appreciated. Thank you.
    Dave
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Data.SqlClient;
    using ClosedXML.Excel;
    using DocumentFormat.OpenXml;
    using System.IO;
    namespace LoanOrig_FDIC_Codes
    public partial class Form1 : Form
    SqlCommand sqlCmd;
    SqlDataAdapter sqlDA;
    DataSet sqlDS;
    DataTable sqlDT;
    SqlCommand sqlCmdCnt;
    public Form1()
    InitializeComponent();
    //BEGIN BUTTON LOAD CLICK EVENT
    private void btnLoad_Click(object sender, EventArgs e)
    string sqlCon = "Data Source=FS-12345; Initial Catalog=ExtractGenerator; User ID=MyUser; Password=MyPW";
    //Set the 2 dateTimePickers to today's date
    DateTime @endDate = End_dateTimePicker.Value.Date;
    DateTime @startDate = Start_dateTimePicker.Value.Date;
    //Validate the values of the 2 dateTimePickers
    if (endDate < startDate)
    MessageBox.Show("End Date must be greater than or equal to the Start Date OR Start Date must be less than or equal to the End Date ", "Incorrect Date Selection",MessageBoxButtons.OK,MessageBoxIcon.Error);
    //Reset both dateTimePickers to todays date
    Start_dateTimePicker.Value = DateTime.Today;
    End_dateTimePicker.Value = DateTime.Today;
    return;
    //End of date validation
    string sqlData = @"SELECT AcctNbr,
    CurrAcctStatCD,
    Org,
    MJAcctTypCD,
    MIAcctTypCD,
    NoteOriginalBalance,
    ContractDate,
    FDICCATCD,
    FDICCATDESC,
    PropType,
    PropTypeDesc
    FROM I_Loans
    WHERE CAST(ContractDate AS datetime) BETWEEN @startdate AND @enddate ORDER BY ContractDate";
    SqlConnection connection = new SqlConnection(sqlCon);
    SqlCommand sqlCmd = new SqlCommand(sqlData, connection);
    sqlCmd.Parameters.AddWithValue("@startDate", startDate);
    sqlCmd.Parameters.AddWithValue("@endDate", endDate);
    sqlDS = new DataSet();
    sqlDA = new SqlDataAdapter(sqlCmd); //SqlAdapter acts as a bridge between the DataSet and SQL Server for retrieving the data
    connection.Open();
    sqlDA.SelectCommand = sqlCmd; //SqlAdapter uses the SelectCommand property to get the SQL statement used to retrieve the records from the table
    sqlDA.Fill(sqlDS, "I_Loans"); //SqlAdapter uses the "Fill" method so that the DataSet will match the data in the SQL table
    sqlDT = sqlDS.Tables["I_Loans"];
    //Code section to get record count
    sqlCmdCnt = connection.CreateCommand();
    sqlCmdCnt.CommandText = "SELECT COUNT(AcctNbr) AS myCnt FROM I_Loans WHERE ContractDate BETWEEN @startDate AND @endDate";
    sqlCmdCnt.Parameters.AddWithValue("@startDate", startDate);
    sqlCmdCnt.Parameters.AddWithValue("@endDate", endDate);
    int recCnt = (int)sqlCmdCnt.ExecuteScalar();
    txtRecCnt.Text = recCnt.ToString();
    btnExport.Enabled = true;
    //End of code section for record count
    connection.Close();
    dataGridView1.DataSource = sqlDS.Tables["I_Loans"];
    dataGridView1.ReadOnly = true;
    //Reset both dateTimePickers to todays date
    Start_dateTimePicker.Value = DateTime.Today;
    End_dateTimePicker.Value = DateTime.Today;
    //END BUTTON LOAD CLICK EVENT
    //BEGIN BUTTON EXPORT CLICK EVENT
    private void btnExport_Click(object sender, EventArgs e)
    SaveFileDialog saveFD = new SaveFileDialog();
    { //ClosedXML code to export datagrid result set to Excel
    string dirInfo = Path.GetPathRoot(@"\\FS-03250\users\dyoung\LoanOrig_FDIC_Codes");
    if (Directory.Exists(dirInfo))
    var wb = new XLWorkbook();
    var ws = wb.Worksheets.Add(sqlDT);
    ws.Tables.First().ShowAutoFilter = false;
    //SaveFileDialog saveFD = new SaveFileDialog(); //I moved this variable to the top of the btnExport code block so that the variable will be available thru the entire scope of that code block
    saveFD.Title = "Save As";
    saveFD.Filter = "Excel File (*.xlsx)| *.xlsx";
    saveFD.FileName = "LoanOrig_FDIC_Codes_" + DateTime.Now.ToString("yyyy-MM-dd");
    if (saveFD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
    Stream stream = saveFD.OpenFile();
    wb.SaveAs(stream);
    stream.Close();
    else if (saveFD.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
    MessageBox.Show("Save file operation has been canceled", "Save As Canceled", MessageBoxButtons.OK, MessageBoxIcon.Stop);
    return;
    //End of ClosedXML code
    MessageBox.Show("File has been exported to " + saveFD.FileName, "File Exported", MessageBoxButtons.OK, MessageBoxIcon.Information);
    //MessageBox.Show("File has been exported to U:\\LoanOrig_FDIC_Codes", "File Exported", MessageBoxButtons.OK, MessageBoxIcon.Information);
    else
    MessageBox.Show("Drive " + saveFD.FileName + " " + "not found, not accessible, or you may have invalid permissions");
    //MessageBox.Show("Drive " + "U:\\Visual Studio Projects\\LoanOrig_FDIC_Codes" + " " + "not found, not accessible, or you may have invalid permissions");
    return;
    //END THE SAVE AS PROCESS
    //END BUTTON EXPORT CLICK EVENT
    private void Form1_Load(object sender, EventArgs e)
    //Set dates to be today's date when the form is openend
    Start_dateTimePicker.Value = DateTime.Today;
    End_dateTimePicker.Value = DateTime.Today;
    private void Form1_Load_1(object sender, EventArgs e)
    // TODO: This line of code loads data into the 'dataSet1.I_Loans' table. You can move, or remove it, as needed.
    this.i_LoansTableAdapter.Fill(this.dataSet1.I_Loans);
    private void iLoansBindingSource_CurrentChanged(object sender, EventArgs e)
    private void btnExit_Click(object sender, EventArgs e)
    this.Close();
    David Young

    In SQL you have a login which allows access to the server but you must also have permissions to access each database that you will use (including Master). So I would verify that your user also has the necessary permissions on the database itself and
    not just the SQL instance. The error you're getting is from SQL saying that the user doesn't have permissions.  If it works for 1 DB but not the other on the same SQL instance then it is likely a missing permission on the DB itself.
    I should note that you have a hard coded conn string in your code but the error is for a different user.  I'm assuming that you simply posted it there for convenience and that you changed the values to obscure the data.  If you are actually getting
    the info from your config file then verify the connection string is correct. Also be sure to not use Integrated Security since it appears that you are using SQL authentication.

  • Weblogic with Active Directory Authentication provider problem: DN for user ....: null

    I have a java application (SSO via SAML2) that uses Weblogic as a Identity Service Provider. All works well using users created directly in Weblogic. However, I need to add support for Active Directory. So, as per documentation:
    - I defined an Active Directory Authentication provider
    - changed it's order in the Authentication Providers list so that it comes first
    - set the control flag to SUFFICIENT and configured the Provider Specific; here's the concerned part in config.xml:
    <sec:authentication-provider xsi:type="wls:active-directory-authenticatorType">
            <sec:name>MyOwnADAuthenticator</sec:name>
            <sec:control-flag>SUFFICIENT</sec:control-flag>
            <wls:propagate-cause-for-login-exception>true</wls:propagate-cause-for-login-exception>
            <wls:host>10.20.150.4</wls:host>
            <wls:port>5000</wls:port>
            <wls:ssl-enabled>false</wls:ssl-enabled>
            <wls:principal>CN=tadmin,CN=wl,DC=at,DC=com</wls:principal>
            <wls:user-base-dn>CN=wl,DC=at,DC=com</wls:user-base-dn>
            <wls:credential-encrypted>{AES}deleted</wls:credential-encrypted>
            <wls:cache-enabled>false</wls:cache-enabled>
            <wls:group-base-dn>CN=wl,DC=at,DC=com</wls:group-base-dn>
    </sec:authentication-provider>
    I configured a AD LDS instance(Active Directory Lightweight Directory Services) on a Windows Server 2008 R2. I created users and one admin user "tadmin" which was added to Administrators members. I also made sure to set msDS-UserAccountDisabled property to FALSE.
    After restarting Weblogic I can see that the AD LDS's users and groups are correctly fetched in Weblogic. But, when I try to connect with my application, using Username:tadmin and Password:<...> it does not work.
    Here's what I see in the log file:
    <BEA-000000> <LDAP Atn Login username: tadmin>
    <BEA-000000> <authenticate user:tadmin>
    <BEA-000000> <getConnection return conn:LDAPConnection {ldaps://10.20.150.4:5000 ldapVersion:3 bindDN:"CN=tadmin,CN=wl,DC=at,DC=com"}>
    <BEA-000000> <getDNForUser search("CN=wl,DC=at,DC=com", "(&(&(cn=tadmin)(objectclass=user))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))", base DN & below)>
    <BEA-000000> <DN for user tadmin: null>
    <BEA-000000> <returnConnection conn:LDAPConnection {ldaps://10.20.150.4:5000 ldapVersion:3 bindDN:"CN=tadmin,CN=wl,DC=at,DC=com"}>
    <BEA-000000> <getConnection return conn:LDAPConnection {ldaps://10.20.150.4:5000 ldapVersion:3 bindDN:"CN=tadmin,CN=wl,DC=at,DC=com"}>
    <BEA-000000> <getDNForUser search("CN=wl,DC=at,DC=com", "(&(&(cn=tadmin)(objectclass=user))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))", base DN & below)>
    <BEA-000000> <DN for user tadmin: null>
    <BEA-000000> <returnConnection conn:LDAPConnection {ldaps://10.20.150.4:5000 ldapVersion:3 bindDN:"CN=tadmin,CN=wl,DC=at,DC=com"}>
    <BEA-000000> <javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User tadmin denied
      at weblogic.security.providers.authentication.LDAPAtnLoginModuleImpl.login(LDAPAtnLoginModuleImpl.java:229)
      at com.bea.common.security.internal.service.LoginModuleWrapper$1.run(LoginModuleWrapper.java:110)
    So, I tried to look why do I have: <DN for user tadmin: null>. Using Apache Directory Studio I reproduced the ldap search request used in Weblogic and, sure enough, I get no results. But, changing the filter to only "(&(cn=tadmin)(objectclass=user))" (NOTICE, no userAccountControl), it works; here's the result from Apache Directory Studio:
    #!SEARCH REQUEST (145) OK
    #!CONNECTION ldap://10.20.150.4:5000
    #!DATE 2014-01-23T14:52:09.324
    # LDAP URL     : ldap://10.20.150.4:5000/CN=wl,DC=at,DC=com?objectClass?sub?(&(cn=tadmin)(objectclass=user))
    # command line : ldapsearch -H ldap://10.20.150.4:5000 -x -D "[email protected]" -W -b "CN=wl,DC=at,DC=com" -s sub -a always -z 1000 "(&(cn=tadmin)(objectclass=user))" "objectClass"
    # baseObject   : CN=wl,DC=at,DC=com
    # scope        : wholeSubtree (2)
    # derefAliases : derefAlways (3)
    # sizeLimit    : 1000
    # timeLimit    : 0
    # typesOnly    : False
    # filter       : (&(cn=tadmin)(objectclass=user))
    # attributes   : objectClass
    #!SEARCH RESULT DONE (145) OK
    #!CONNECTION ldap://10.20.150.4:5000
    #!DATE 2014-01-23T14:52:09.356
    # numEntries : 1
    (the "[email protected]" is defined as userPrincipalName in the tadmin user on AD LDS)
    As you can see, "# numEntries : 1" (and I can see as result the entry "CN=tadmin,CN=wl,DC=at,DC=com"  in Apache Directory Studio's interface); if I add the userAccountControl filter I get 0.
    I've read that the AD LDS does not use userAccountControl but "uses several individual attributes to hold the information that is contained in the flags of the userAccountControl attribute"; among those attributes is msDS-UserAccountDisabled which, as I said, I already set to FALSE.
    So, my question is, how do I make it work? Why do I have "<DN for user tadmin: null>" ? Is it the userAccountControl ? If it is, do I need to do some other configuration on my AD LDS ? Or, how can I get rid of the userAccountControl filter in Weblogic?
    I didn't seem to find it in config files or in the interface: I only have "User From Name Filter: (&(cn=%u)(objectclass=user))", there's no userAccountControl.
    Another difference I noticed is that, even though in Weblogic I have set ssl-enabled flag to false, in the logs I see ldaps and not ldap ( I'm not looking to setup something production-ready and I don't want SSL for the moment ).
    Here are some other things I tried but did not change anything:
    - the other "msDS-" attributes were not set so I tried initializing them to some value
    - I tried other users defined in AD LDS, not tadmin
    - in Weblogic I added users that were imported from AD LDS in Roles and Policies> Realm Roles > Global Roles > Roles > Admin
    - I removed all userAccountControl occurrences that I found in xml files in Weblogic (schema.ms.xml, schema.msad2003.xml)
    Any thoughts?
    Thanks.

    I managed to narrow it down: the AD LDS does not support the userAccountControl.
    Anyone knows how I can configure my Active Directory Authentication Provider in Weblogic so that it does not implicitly use userAccountControl as filter?
    <BEA-000000> <getDNForUser search("CN=wl,DC=at,DC=com", "(&(&(cn=tadmin)(objectclass=user))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))", base DN & below)> 

  • To fix the length of a textfield for user to enter date

    hi,
    i need to display a textfield for user to enter the date in the format MM/DD/YY.With the slash in between present and fixed and the possibility of entering only 2 digit figures for the month,day n' year.I am using JTextField .how can i acheive that pls help.

    You must design you own document where you will manage the text that will be entered/displayed in your textfield
    here's a sample of the code I use to do this:
    import javax.swing.JTextField;
    import java.io.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MaskedTextField extends JTextField
    private String initStr;
    public MaskedTextField (String mask, String initStr)
    super();
    setDocument(new MaskedDocument(initStr, mask, this));
    setText(initStr);
    this.initStr = initStr;
    this.addMouseListener(new java.awt.event.MouseAdapter()
    public void mouseClicked(MouseEvent m)
    this_mouseClicked(m);
    private void this_mouseClicked(MouseEvent m)
    if (getText().equals(initStr)) setCaretPosition(0);
    class MaskedDocument extends PlainDocument
    String mask;
    String initStr;
    JTextField tf;
    public MaskedDocument(String initStr, String mask,
    MaskedTextField container)
    this.mask = mask;
    this.initStr = initStr;
    tf = container;
    void replace(int offset, char ch, AttributeSet a)
    throws BadLocationException
    super.remove(offset,1);
    if (capitalised) super.insertString(offset,
    String.valueOf(ch).toUpperCase(),a);
    else super.insertString(offset, "" + ch, a);
    public void remove(int offs, int len) throws BadLocationException
    if (len==0)
    return;
    // Remove current contents
    super.remove(offs, len);
    // Replace the removed part by init string
    super.insertString(offs,initStr.substring(offs,offs+len),
    getAttributeContext().getEmptySet());
    tf.setCaretPosition(offs);
    public void insertString(int offset, String str, AttributeSet a)
    throws BadLocationException
    if ((offset==0) && str.equals(initStr))
    // Initialisation of text field
    super.insertString(offset,str,a);
    return;
    if (str.length()==0)
    super.insertString(offset,str,a);
    return;
    for (int i=0;i<str.length();i++)
    while ((offset+i) < mask.length())
    if (mask.charAt(offset+i)=='-')
    // Skip fixed parts
    offset++;
    else
    // Check if character is allowed according to mask
    if (str.charAt(i) != this.initStr.charAt(i))
    switch (mask.charAt(offset+i))
    case 'D': // Only digitis allowed
    if (!Character.isDigit(str.charAt(i)))
    return;
    break;
    case 'C': // Only alphabetic characters allowed
    if (!Character.isLetter(str.charAt(i)))
    return;
    break;
    case 'A': // Only letters or digits characters allowed
    if (!Character.isLetterOrDigit(str.charAt(i)))
    return;
    break;
    replace(offset+i, str.charAt(i),a);
    break;
    else
    i++;
    offset--;
    // Skip over "fixed" characters
    offset += str.length();
    while ((offset<mask.length()) && (mask.charAt(offset)=='-'))
    offset++;
    if (offset<mask.length())
    tf.setCaretPosition(offset);
    if (offset == mask.length()) tf.setCaretPosition(offset);
    Enjoy
    Bernie

  • HT201317 Remove the "By user name" title in Photo Stream

    Is there a way to remove the "By User Name" title displayed in the upper right-hand corner of a shared Photo Stream? I sell stuff online and I would like to use the Photo Stream to post photos of, let's say, a furniture set. However, I'd like to maintain a little privacy by not having my first and last name displayed in the shared Photo Stream page.
    Is there a way to do that, or would I have to change my profile name entirely to something like Furniture Master, so that iCloud displays that instead?

    I don't think Photo Stream is for commercial use.

  • Variable not appearing for User

    Hi everyone!
    I have a query which the user have been using for quite some time and it was working fine. When the query is run the user has option of 3 input variables.
    Today, all of a sudden, the 3rd variable does not show up for that user. The query runs fine for every other user. I mean all 3 input variables show up.
    Some how only for this particular user, the 3rd variable does not appear.
    Has any one encountered this situation. Can any one provide me some possible areas to look into as to what might have changed or what could be causing this problem.
    All your help is appreciated.
    Thankx!
    Kumar.

    Hi Raj,
    I did try to remove the personalization on the user's system. But the variable still did not appear. I noticed few more things. The variable is "Site ID" (custom one).
    1) The  Site variable does not appear even on other queries only for this user.
    2) I tried to make the user use another system and run the query, it still does not appear.
    3) I created another query for user just to display the Site ID without any variable. It runs fine. When I created a selection variable for Site ID on the same query now the variable again does not appear.
    So I think it must be either a change in authorization or change in definition.
    Can you think of any other issue it might be encountering?
    Thankx!
    Edited by: kumar saurabh on Aug 25, 2008 4:50 PM

Maybe you are looking for

  • Reading Canon 5D EXIF Metadata in Bridge CS4

    When I look on the LCD of my Canon 5d, I can see all sorts of data on the settings, mode(Bulb, AV, TV, P, Full Auto), focal length, etc. for each image I take.  I would like to know if there is a way in Bridge to see what Camera Mode the camera was i

  • Res Id and Location not showing up in MSP_EpmResource_UserView

    Hi  If I use below Query it shows me Res Id and Resource Location fields. SELECT *FROM  dbo.MSP_EpmResource_UserView but When I add above fields to below Query, it gives me an error saying Invalid coloumn.              SELECT                MSP_EpmRe

  • Can´t open host:port/pls/htmldb

    I have installed Oracle HTTP Server, and HTML DB, after running the sql-script: htmldbins.sql succesfully. No errors after installing the Http-server, and Html db. I can access host:7777 and get the default page, but cannot access host:7777/pls/htmld

  • Bookmarks are added even though I've not requested them.

    Whenever I click on Bookmarks>Recently added a whole list of pages appear that I have not bookmarked. I then have to go and delete each and every one, one at a time. This is annoying, as it then takes forever to find my recent bookmarked pages. I can

  • Cancellation Charges

    We are due to move house in 2 weeks. Its a different area code, and i would like sky in the new property. The new house is currently empty so i dont think there is a live phoneline there at the mo, there has been in the past though. I obviously need