"Set-aduser -clear" using variables

Hello all,
Is it possible to clear an attribute from a user using variables? For example, this little command works fine:
get-aduser User31 | set-aduser -clear extensionattribute2, extensionattribute3
However, I'd like to use this command with variables, like if I didn't know what attributes I wanted to clear beforehand, and could add these attributes to a variable and then pass them to set-aduser:
$Variables = "extensionattribute2, extensionattribute3"
get-aduser User31 | set-aduser -clear $Variables
This command will not work, and I'm not sure if it's possible to use variables with the "-clear" parameter of "set-aduser"?

Hi,
You can do that this way:
$attributes = 'extensionAttribute2','extensionAttribute3'
Set-ADUser -Identity tester1 -Clear $attributes
Examples:
Before:
Get-ADUser -Identity tester1 -Properties extensionAttribute2,extensionAttribute3 |
Select SamAccountName,extensionAttribute2,extensionAttribute3
SamAccountName extensionAttribute2 extensionAttribute3
tester1 ex2 ex3
After:
SamAccountName extensionAttribute2 extensionAttribute3
tester1
Don't retire TechNet! -
(Don't give up yet - 12,950+ strong and growing)

Similar Messages

  • Using HttpHeader to set value for session variables

    Hi,
    We want to set values for 2 session variables (USER and ROLEID) using HttpHeader in obiee 11g. Has anyone tried this? How can we achieve this?
    I found the below note on the forum for setting value for the USER session variable. how can we set the ROLEID session variable also? is it possible to set values for 2 variables?
    for setting the USER session variable,
    You should add this in $BI_HOME/bifoundation/web/display/authenticationschemas.xml:
    <SchemaKeyVariable source="httpHeader" nameInSource="Proxy-Remote-User" forceValue="SSO"/>
    <AuthenticationSchema name="SSO" displayName="Single Sign On" userID="IMPERSONATE" proxyUserID="NQ_SESSION.RUNAS" options="noLogoffUI noLogonUI">
    <RequestVariable source="httpHeader" type="auth" nameInSource="Proxy-Remote-User" biVariableName="IMPERSONATE" options="required"/>
    </AuthenticationSchema>
    Please suggest.
    Thanks.

    I think maybe your SnmpValue type or value is not corrent.
    1.3.6.1.4.1.7064.201.1.200.100.0 is Enum control type
    when I use
    SnmpValue val = new SnmpString("0");
    It doesn't work, but when I use
    SnmpValue val = new SnmpInt(0);
    It works. I think the JDMK should give some warning message when the type is not correct. :)
    The code is following:
    final SnmpVarBindList setList = new SnmpVarBindList(" set varbind list ");
    SnmpOid oid = new SnmpOid("1.3.6.1.4.1.7064.201.1.200.100.0");
    SnmpValue val = new SnmpInt(0);
    SnmpVarBind valueBind = new SnmpVarBind(oid, val);
    setList.addVarBind( valueBind );
    SnmpRequest setRequest = session.snmpSetRequest(null, setList);

  • DSC alarm set and cleared without operator ack - the variable should be not alarmed and not acked

    We are deeply involved in porting our application from 7.1.1 to 8.6.1 under Windows XP.
    Our application  heavily depends on DSC and moving from 7.1.1 to 8.6.1 is actually much more than a simple porting....
    here is our last problem:
    it seems that there is no discrimination between 'active' alarms and 'acknowledged' alarms on a shared Variable  in case the 'ack Type' is set to 'USER'.
    Here is what happens:
    1) a Boolean shared variable is defined to be alarmed when 'high' (TRUE) and its ack type is set to 'USER' (the operator at our application must ack alarms).
    2) the Boolean var is set to TRUE -> it is declared alarmed (OK)  and not ack'ed (OK)
    3) the operator ack the variable -> it is declared alarmed (OK)  and ack'ed (OK)
    4) the Boolean var is set to FALSE -> it is declared not alarmed (OK)  and ack'ed (OK)
    5) the Boolean var is set to TRUE -> it is declared alarmed (OK)  and not ack'ed (OK)
    6) the Boolean var is set to FALSE -> it is declared alarmed (NOT OK!!!)  and not ack'ed (OK)
    7) the operator ack the variable -> it is declared not alarmed (OK)  and ack'ed (OK)
    This last case is the wrong situation: an alarm has been set and cleared without operator ack the variable should be not  alarmed  and not acked 
    Actually the variable returns OK only when ack'ed.
    see the attached project in which a small vi and a small shared variable lvlib allows to repeat the above steps.
    Note:
    A) same situation applies to 'double' shared variable
    B) under DSC version 7.1.1 everithing was OK 
    can anyone Help?
    Thank You Guglielmo Rozera
    Attachments:
    AlmAckTest.zip ‏18 KB

    Thank for your replay!
    I have tried to undeploy and deploy the library with ack type set to 'User' by default, and then run the vi but the behavior is always the same.
    The modification you suggest does not set 'User' ack type because data socket needs '2'  as 'User ' setting while property node needs '1' or (better) its own enumerated type.
    Anyway I've corrected the vi according to your suggestion and tried again but nothing changed...
    Here I attach the project modified with property node and an indicator to show what is the actual ack type
    I hope in your further investigations!
    Thank You
    Guglielmo 
    Attachments:
    AlmAckTest_2.zip ‏20 KB

  • How to clear the variable value in session store?

    I'll try to build form for search. There are LOV and
    search button on form. When user don't select anything then push
    search button, I'd like the report to show query everything. I
    mean the report will show like condition where id like '%'.
    And I send variable between form to report by using session
    store.
    I select nothing in LOV but value that return by LOV is
    not null. It's in stead of old value of LOV.
    Please tell me.. How to clear the variable value in
    session store? I'd like to set it to null. If you have greater
    way to do like this, please tell me.
    Thank you.

    Please suggest on this..
    Thanks.

  • Setting empty Selections in Variables

    When setting a user-exit variable to initial for unassigned values, the variable value in the planning level displays the '#'.  When entering data for this selection in a layout and saving it, everything looks fine.  The data records are written to the cube and can be verified using list cube.  However, when exiting the layout and returning the newly created records do not show up.  If I take the variable out of the selection on the package and open the layout I can see the values.  I've tried everything I can think of as far as assigning values to the variable to represent unassigned.  I've tried the # sign, clearing the values, and assigning space but this behavior persists.  Does anyone have any ideas on this problem.
    thanks,
    Chuck Hall

    Hi,
    Thanks for your message. I have found the reason of my problem.
    We use 0SOURSYSTEM as a primary key of all the characteristics (compounding). We have 2 source systems. In the SID tables, SAP has got three entries for the initial values of my characteristic 0NETWORK.
    0SOURSYSTEM      NETWORK
    0                             0
    R1                           0
    F1                           0
    When I inserted the 0NETWORK to my cube, SAP grabbed its first index 0/0, and I was expecting having the second R1/0.
    So the combination does not match when I execute a layout.
    I'll now use Remodeling to remove 0NETWORK and put it back with the value R1/0.
    Thanks
    Laurent

  • How to clear the variables before closing a BSP MVC application

    I am calling a custom stateful BSP MVC application to display additional PO information as a popup window inside SAP BSP. When I close this popup window and open it later on a different PO, it still displays the old PO information. I am clearing the variables in the DO_HANDLE_EVENT. 
    I am using the javascript
    <htmlb:button id      = "Close"
                        text    = "Close window"
                        onClientClick="javascript:window.close()"  />
    to close the window.
    Could someone tell me what do I need to do before closing so that I can clear all the variables.

    Hi Krishana,
    Other neater way could be..
    instead of calling java script.. raise a server event.. in DO_HANDLE_EVENT set a flag <b>lv_close_window</b> to 'X'.
    on the page call the script to close the window if flag <b>lv_close_window</b> is set to 'X'.
    just before setting rhe flag to 'X' you can clear all unnecessary data.
    rememebr: javascript wont take you to DO_HANDLE_EVENT.
    <htmlb:button id = "Close"
    text = "Close window"
    onClick="close_window" />
    i would to this way if i am willing to go to DO_HANDLE_EVENT.
    A.

  • Set-ADUser -Replace

    Hi
    I could be wrong, but I think there's an error in the help for Set-ADUser, in the section describing the -Replace parameter:
    For example, if you want to replace the value "555-222-2222" with the values
    "555-222-1111" for Phone-Office-Other attribute (LDAP display name
    'otherTelephone') set the Replace parameter as follows.
    -Replace @{otherTelephone='555-222-2222', '555-222-1111'}
    Wouldn't that example set the otherTelephone property to the two values given rather than replacing the first one wuth the second?
    Thanks

    Looks like you're right. I just took a look through the AD cmdlets with dotPeek, and when the -Replace parameter is used (with an array), it calls Clear() followed by AddRange() on the property collection:
    if (customPropertyValue is object[])
    propertyValue.Clear();
    propertyValue.AddRange((object[]) customPropertyValue);
    else
    propertyValue.Value = customPropertyValue;

  • Using variable with the same name as field name?

    I have a complex proc where I have variables with the same name as field name used on a query. something like this:
    SELECT a.id_table WHERE a.id_table = id_table
    where the last id_table is a parameter sent to the proc:
    declare procedure myproc(id_table int)
    Is there any way or notation to declare the variable inside the query as a variable or I have to use a different name?

    Well, variables are not the only thing you have to change if you want to switch to Oracle.
    Although I don't think it is good practice (to use variable name same as column name), here is one example how you can achieve it using EXECUTE IMMEDIATE and bind variable
    SQL> select deptno, count(1)
      2  from scott.emp
      3  group by deptno;
        DEPTNO   COUNT(1)
            30          6
            20          5
    10 3
    SQL> set serveroutput on
    SQL> declare
      2  deptno varchar2(10);
      3  i number;
      4  begin
      5  deptno:=10;
      6  execute immediate
      7  'select count(1) from scott.emp where deptno=:deptno' into i using deptno;
      8  dbms_output.put_line('OUT ---> '||i);
      9  end;
    10  /
    OUT ---> 3
    PL/SQL procedure successfully completed.
    SQL> Message was edited by:
    tekicora
    Message was edited by:
    tekicora

  • How do i filter the records in analytic view by using variable/parameter for a time range

    i have a analytic view which has a output column as date type. i want the user who use this view have the control to decided the output records based on a time range (from x to y).
    i tried to create 2 variables, 1 for start_time, 1 for end_time. Ideally, i should have a expression for filtering data like this:
    $$start_time <= date_column <= $$end_time
    However, the variable windows doesn't seem to be feasible for the expression as above.
    Does anyone has the same problem and get it solved?
    Thanks!

    just figured out by my own. So the answer is using "variable" with "range" option.
    Making a variable, then set the "selection type" to "range".
    When preview the data, the variable input window pops up with operator on default "equal", use dropdown list to swtich it to "between", then you can enter the start_time and end_time as a range filter.

  • Find text from a file and set it as a variable in applescript?

    I am trying to build a script that sends me updates and notifications from cex.io. Please keep on reading below, so I may guide you until the point I have trouble with.
    The first simple script in this operation goes to cex.io's trading page for BTC/GHS. It records ands saves the text to a file every 4 seconds. It works great. It doesn't need to have safari refresh because the site pushes info to the browser live.
      repeat
              set the webpage_content to ""
              tell application "Safari" to set the webpage_content to the text of document 1
              set theText to webpage_content
              set a to "Macintosh HD:Users:PRIVATE:Desktop:CEX:"
              set theFile to (open for access file ((a) & "CEXRaw") with write permission)
              write theText to theFile
              close access theFile
              delay 4
      end repeat
    And it returns this from the site to this main file every 4 seconds: (note I cut off a chunk from the bottom and the top of the file, because they are unimportant)
        GHS:
        0.05233439
        BTC:
        0.00000223
        NMC:
        0.00002939
        LTC:
        0.00000000
        GHS/BTC
        0.02362958 LTC/BTC
        0.02438131 NMC/BTC
        0.00597565 GHS/NMC
        3.96951800 BF1/BTC
        1.67000000 Fund Account
        GHS/BTC
        Last price:
        0.02362958
        Daily change:
        -0.00018042
        Today's open:
        0.02381000
        24h volume:
        73812.35539255
    I now need an applescript to read that file, and return wanted values. But I'm lost on how to write it.
    It needs to find the number under BTC, and set it as a variable.
    It needs to find the number under GHS, and set it as a variable.
    It needs to find the number under Last Price, and set it as a variable.
    If anyone could script that really quick for me, or tell me how to do it, that would be amazing. Thank you so much!

    Couldn't tell if you had any whitespace in the lines (i.e. is there a space before or after GHS:), so I used contains, not is.  Also, if you have a line such as GHS/BTC with a colon GHS/BTC:  then it will also fail (as contains "BTC:" would be true for BTC: and GHS/BTC:)
    However, this will give you some guidance:
    set a to "Macintosh HD:Users:PRIVATE:Desktop:CEX:CEXRaw"
    set x to 0
    set Names to paragraphs of (read file a)
    repeat with nextLine in Names
              set x to x + 1
              if nextLine contains "BTC:" then
                        set BTC to item (x + 1) of Names
              else if nextLine contains "GHS:" then
                        set GHS to item (x + 1) of Names
              else if nextLine contains "Last Price:" then
                        set lastPrice to item (x + 1) of Names
              end if
    end repeat

  • Reciever File Adapter - Temp File Name Scheme using Variable Substitution

    How can I create a temporary file that uses variable substitution? 
    We are having a problem with files merging when we write files using the "Use Temporary File" setting on the FIle Adapter.  So two independent files are merging into a single file.  We are not using the "Append" setting.
    We would like to use a Temp File Name Scheme that would append the message id onto the temporary file name. 
    Using variable substitution we created a msgid variable.  When added to the temporary file name using %msgid% the temporary file name is created with %msgid% in the name instead of the actual message id.  We put the variable into the "File Name Scheme" as well and the end completed file used the message id in the name.
    Any Ideas?
    Thanks,
    Matt

    HI Matthew,
    Why are you adding the message id into the temporary file??
    I understand that you want the output of the filename to contain message id .. and hence you are using variable substitution for the same.
    Temporary file name will anyways get overwritten by the actual file name (here the actual filename will be using variable substituion).
    So i suggest to achieve your scenario you can add any name in the temporary file and maintain the desired filename you require as output in the variable subsititution.
    Temporary File Name option actually acts as a lock - unlock mechanism from PI side while the file is getting written to the file server so that while PI is writting the file no third party application batch program picks it up.
    I hope this helps.
    Cheers
    Dhwani

  • Problem with Multimapping using Variable Susbtitution

    Hi,
    I have done a Multi-Mapping where I have used variable substitution in the mapping
    The problem I am facing is that when my target message generates multiple messages the files are creating successfully on the FTP server but if only a
    single message generates on the target side then my message is successfully processed in IS but in adapter engine the message status is in "Waiting" state.
    When i see the audit log i found the following details:
    Time Stamp Status Description
    2007-09-18 06:10:24 Success The message was successfully received by the messaging system. Profile: XI URL: https://dx1-60.ra.rockwell.com:56001/MessagingSystem/receive/AFW/XI
    2007-09-18 06:10:24 Success Using connection AFW. Trying to put the message into the receive queue.
    2007-09-18 06:10:24 Success Message successfully put into the queue.
    2007-09-18 06:10:24 Success The message was successfully retrieved from the receive queue.
    2007-09-18 06:10:24 Success The message status set to DLNG.
    2007-09-18 06:10:24 Error Unable to find channel ID
    2007-09-18 06:10:24 Error Delivery of the message to the application using connection AFW failed, due to: Couldn't find delivery channel for message: 46ee0b73-f266-3794-e100-000082974e17.
    2007-09-18 06:10:24 Success The asynchronous message was successfully scheduled to be delivered at Tue Sep 18 06:15:24 GMT 2007.
    2007-09-18 06:10:24 Success The message status set to WAIT.
    2007-09-18 06:15:24 Success Retrying to deliver message to the application. Retry: 1
    Iam using SP14
    Can anyone help me to solve the above problem

    DATA: l_tabname TYPE tabname .
    DATA : gi_mara TYPE TABLE OF mara ,
           gi_makt TYPE TABLE OF makt .
    l_tabname = 'MARA' .
    DATA         : l_dref TYPE REF TO data.
    FIELD-SYMBOLS: <li_itab> TYPE ANY TABLE.
    CREATE DATA l_dref TYPE TABLE OF (l_tabname).
    ASSIGN l_dref->* TO <li_itab>  .
    *Define another field symbol and asign it to right internal table
    *here naming of internal table is important
    FIELD-SYMBOLS : <fs_tab> TYPE ANY TABLE .
    CONCATENATE 'GI_' l_tabname INTO l_tabname .
    ASSIGN (l_tabname) TO <fs_tab>.
    <fs_tab> = <li_itab> .

  • SAP PI: Using Variable Header  Binding in Receiver Mail Adapter

    Hello,
    I try to use Variable Header Bindings in the Receiver Mail Adapter. Therefore I wrote the following User-Defined-Function in a mapping:
    Java Function Start -
    DynamicConfiguration conf = (DynamicConfiguration) container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create(
        "http://sap.com/xi/XI/System/Mail",
        "XHeaderName1");
    DynamicConfigurationKey key2 = DynamicConfigurationKey.create(
        "http://sap.com/xi/XI/System/Mail",
        "XHeaderName2");
    DynamicConfigurationKey key3 = DynamicConfigurationKey.create(
        "http://sap.com/xi/XI/System/Mail",
        "XHeaderName3");
    conf.put(key1, new String("Test1"));
    conf.put(key2, new String("Test2"));
    conf.put(key3, new String("Test3"));
    Java Function End -
    As expected I see the Attributes and Parameters in the Dynamic Configuration in the SAP XI Monitor:
    Dynamic Configuration Informattion Start -
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Mapping der Request-Message
      -->
    - <SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Record namespace="http://sap.com/xi/XI/System/Mail" name="XHeaderName3">Test3</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/Mail" name="XHeaderName2">Test2</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/Mail" name="XHeaderName1">Test1</SAP:Record>
      </SAP:DynamicConfiguration>
    Dynamic Configuration Informattion End -
    Now I configure my Receiver eMail Communication Channel and set the Variable Header Fields as follows:
       Adapter Specific Attributes: Checked
       Variable Transport Binding: Checked
       Variable Header (XHeaderName1): TSender
       Variable Header (XHeaderName2): TReceiver
       Variable Header (XHeaderName3): TOther
    With this configuration I would have expected three new Header fields in the Header of the eMail, the reicever gets. But they are not there.
    When I set standard attributes like THeaderTO, THeaderSubject a.s.o this works fine and the values are also set accordingly. Where it the mistake here?
    The PI version we are working with is PI 7.0 SP10.
    Your help will be highly appreciated.
    Thank you,
    Steffen

    Hi Luciana,
    Honestly, I cant really remember how or if it was resolved and I was just helping out on the issue, but another consultant continued with it, so unfortunately I cant be any help on this.
    Good luck!
    Cheers,
    Brad

  • Using variable in select statement (php)

    I am having difficulty using a variable in a select
    statement.
    The following manual query (using a static date) works fine:
    $query_Recordset1 = "SELECT * FROM academyClasses WHERE
    classDate > '2006-06-01' ";
    However, If I use the following:
    $dateVar = date('Y-m-d');
    mysql_select_db($database_mw, $mw);
    $query_Recordset1 = "SELECT * FROM academyClasses WHERE
    classDate > $dateVar ";
    ALL records are returned, which means the $dateVar variable
    is not being recognized. I have compared the $dateVar values
    <?php echo $datetime; ?> against the actual value of my date
    field <?php echo $row_Recordset1['classDate']; ?> in my
    results table and it seems that the values are indeed accurate in
    terms of a date 2006-06-04 for example.
    My date field "classDate" is of a "date" type within the
    mysql database. I'm using Dreamweaver MX 2004 with Mac OSX 10.3.9.
    I'm sure this is just a syntax problem, at least I hope it
    is.
    Any help is greatly appreciated.

    On Wed, 7 Jun 2006 04:49:57 +0000 (UTC), "mgwaters"
    <[email protected]> wrote:
    >Thanks Gary. That did seem to get the select statement
    working, but I had to
    >enter a manual date as before $dateVar = '2006-06-01'; on
    the previous line of
    >code to actually get it to filter my records. So... it
    looks like my setting of
    >the date variable:
    > $dateVar = date('Y-m-d');
    > does not seem to be recognized within the SELECT
    statement.
    Try this:
    $query_Recordset1 = "SELECT * FROM academyClasses WHERE
    classDate>'$dateVar'";
    print $query_Recordset1;
    See what is in the SQL statement.
    Gary

  • Code to set and destroy session variables in Java Server Pages(JSP)

    code to set and destroy session variables in Java Server Pages(JSP)
    we have use following statement to set session variable
    session.setAttribute("userClient",id);
    we have use following statement to destroy session variable
    session.setAttribute("userClient","");
    and
    the session.invalidate() is not working
    Plz. solve this probem

    code to set and destroy session variables in Java
    Server Pages(JSP)
    we have use following statement to set session
    variable
    session.setAttribute("userClient",id);
    we have use following statement to destroy session
    variable
    session.setAttribute("userClient","");Perhaps if you tried using
    session.setAttribute("userClient", null);
    or
    session.removeAttribute("userClient");
    and
    the session.invalidate() is not workingNot working how?
    >
    Plz. solve this probem

Maybe you are looking for