Append to existing Description

I need help on this powershell command
Get-ADuser -searchbase "OU=TEST, OU=Stale Accounts, DC=com" | Set-ADuser $_ -Description "disabled due to inactivity, termrpt $($_.Description)"
What I'm trying to do is add more text to the description wihout deleting the existing description. 
When I run it, I get:
cmdlet Get-ADuser at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
Finter:
I've spend quite some time on this, but just can't get it to work.
Any help would be greatly apprciated.

Well this is a little trickier that it would seem to the unaided eye:
Get-ADuser -filter * -searchbase 'ou=testou,dc=testnet,dc=local' -Properties Description|
foreach{
Set-ADuser $_ -Description "DISABLED:$($_.Description)"
You need to remember that the objects returned by Get-AdUser and all AD CmdLets are minimal objects. We must specify most properties beyond the few basic values. We also need to specify a filter match even when referencing a target OU.
The answer to the original error (or prompt) is to add "-filter *" to the command.  Dirk is correct about needing to reset the description in a "foreach" so we have access to the pipeline variable but the "Description" variable will not be in the pipeline
unless we specify that we want it added.
¯\_(ツ)_/¯

Similar Messages

  • Getting error when trying to append to existing pdf.

    Hello.  I am using Acrobat 9 Pro to save emails.  When using Internet Explorer, I press print and when the document print window opens up I right click on the document and select "Append to existing PDF" or "Convert to Adobe PDF."  This used to work for me.  Now all I get is an error message "An error has occurred in the script on this page" with "res://C:\Program Files(x86)/Common Files/Adobe/Acrobat/ActiveX/AcroIEFavClient.dll/AcroIEAppend.html."  It doesn't matter if I select yes of no to the message "do you wish to continue running script" question.  It just closes the window and does nothing.
    I am running Acrobat 9 Pro, Windows 7 Professional (64) Service Pack 1, Internet Explorer 9.  I also have Acrobat Reader X on my computer.  I think it was automatically installed before I put Acrobat 9 Pro on.

    You don't mention which version of Acrobat, but I doubt it is fully compatible with MSIE 9 which was released after Acrobat X no less Acrobat 9. Adobe doesn't support anything but Reader X with Acrobat X. Any other combination of Reader with Acrobat is known to cause problems. So you have two avenues to explore. First uninstall Reader X and then re-install Acrobat 9. Then upgrade to Acrobat 9.4.5. See if everything works ok. You may be good to go. If it still doesn't work, then you may have a compatibility issue between Acrobat 9 and MSIE 9. Maybe if someone is running that combination successfully, they can chime in here.

  • Append an existing file?

    Hello world,
    I'm stuck in a predicament: The storage guys have asked me to reduce the frequency of backups on three of our instances to save bandwidth on the WAN when the backup files are copied across to another datacenter. The application owners do not want to backup
    any less frequently. 
    We do daily full backups and Tr-log backups every 15 minutes throughout the day.
    Storage have advised that the SAN only copies changes (ie new files or the changes to existing ones)
    Is it possible/ would it be of any benefit, to backup and append an existing file? Can I do this with the logs as with the databases?
    Thanks in advance

    Storage have advised that the SAN only copies changes (ie new files or the changes to existing ones)
    I am not very sure that it will pick changes from existing ones, I think if it sees the file is changed it will start coping as 1 big file and will not solve your purpose. You might get it reconfirm with storage on this. Also even if it does like you said
    I wonder if next backup runs and file is still getting copied over then backup will start failing saying "file is in use".
    If application owner is saying 15 min log backup then we cant reduce the frequency, but if you have some other drive/disk where you can divert tlog backup say for 2 hours then you can run differential backup every 2 hour which goes to SAN. You will be safe
    even if something happen you have tlog on 1 drive and
    differential get copied to other datacenter. (But point in time recovery will be issue as you will not have any tlog backups for restore)
    I cant think of anything else to reduce frequency, but for bandwidth see if you can use compress(enterprise edition) or zip backup file to save bandwidth.

  • Non-enabled or non-existent descriptive flexfield segment

    hi m getting this Error when m trying to Save Text Field value in DFF segment
    A value has been provided for a non-enabled or non-existent descriptive flexfield segment. (SEGMENT=ATTRIBUTE17) (VALUE=Y)
    regards,
    Vivek

    Are you trying to use a DFF segment which is not used in the current context. This means you also have the DFF segments being used on the Page.

  • How to Append an existing Excel file?

    I am using the jexcel api to write to a new excel file. Each time i run my program, it creates a new Excel File by the name i give it. my code to create the excelFile is as below:-
    File excelFile=new File(workDir+"\\"+fileName+".xls");
    WritableWorkbook workbook = Workbook.createWorkbook(excelFile);
    After this code i write some data to a worksheet in the above mentioned excel file. But my requirement is that I want to create the excel if it does not exist, and if it exists, then the data should be appended to the worksheet in the existing excel file. At present it creates a new excel file and does not append it.
    How can it be done? does anyone have any suggestions as to how can i tackle this problem? please suggest something.
    Ankit

    There is no ready-to-run example, as you are searching for, available.
    This has several reasons:
    - It depends on the version of Excel. Examples for Excel 2007 might not work with Excel 2010 for instance.
    - No one just wants to open Excel without doing anything with it.
    The second point is something, i want to ask you:
    Why do you want to open an existing Excel file at all? What is it, what you want to do after opening it?
    If you have LV/C/C#/VB examples doing what you are looking for, why do you want to have it in TestStand directly, so NOT using existing code (saving time and effort) and basically re-inventing the wheel?
    ActiveX is an interface for remote controlling and embedding applications with/in other applications on Windows systems. It is a PROGRAMMING interface.
    So naturally, examples and tutorials exist for programming languages. Those examples are easily converted to TestStand sequences with a basic knowledge of the programming language and TestStand. Providing links for such tutorials/examples is a valid way to give support to fellow developers because we expect the fellow to have that basic knowledge. 
    If that knowledge is not present, i highly recommend to fill that gap.
    just my 2 cents,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Write to text file. Append to existing file. Create file if file doesn't exist.

    Hi folks,
    up to LabVIEW 7 there was a wonderful "Write to Text File" vi which allowed the option "Append to File". Now, in LabVIEW 8, this old vi is not longer supported anymore. Instead, I am suggested to use a new "Write to Text File" vi. This vi does not offer the option "Append to File" anymore. Rather it is proposed in the online help that one should use the "Set File Position" in order to append text to the file. This much less straightforward than the old solution. Furthermore, I miss an option which would create the complete path if it doesn't exist yet.
    To summarize: Isn't there really any smart "Write to Text File" vi available which offers both the options "Append" and "Create path if file does not yet exist". Of course, I could write such a file on my own but I am sure that it is of such general interest that it already exist. In any situation, when a log file shall be written, the wanted vi would be ideal.
    Thanks a lot,
    Peter

    Ray,
    I know that the old vi is still available. See the screenshot which I attach to this message. What I am missing is an option "Create file or even complete path if file or path do not yet exist.". Is there any reason why NI doesn't provide neither this option nor a simple "Append to file" functionality in the new "Write to Text File" vi?
    Regards,
    Peter
    Attachments:
    Clipboard01.png ‏7 KB

  • Importing from XML to Excel - need to know how to append to existing Excel file

    Hello,
    I have several XML files that I will need to import into one Excel spreadsheet. I have been able to figure out how to import an XML file to an Excel file but when I import a second XML file, the contents of the second XML overwrite the Excel spreadsheet.
    I am looking for an option to append. Thanks in advance
    private void XmlToExcel(string xmlFilePath, string excelFilePath)
    object misValue = System.Reflection.Missing.Value;
    DataSet Trans_ds = new System.Data.DataSet();
    Trans_ds.ReadXml(xmlFilePath);
    Excel.Application excel = new Excel.Application();
    excel.Application.Workbooks.Add(true);
    System.Data.DataTable table = Trans_ds.Tables[0];
    Worksheet worksheet = (Worksheet)excel.ActiveSheet;
    Range excelRange = (Excel.Range)worksheet.get_Range("A" + worksheet.Rows.Count, Type.Missing);
    int lastRow = excelRange.get_End(XlDirection.xlUp).Row;
    int ColumnIndex = 0;
    int rowIndex = lastRow++;
    foreach (System.Data.DataColumn col in table.Columns)
    ColumnIndex++;
    excel.Cells[lastRow, ColumnIndex] = col.ColumnName;
    foreach (DataRow row in table.Rows)
    rowIndex++;
    ColumnIndex = 0;
    foreach (DataColumn col in table.Columns)
    ColumnIndex++;
    excel.Cells[rowIndex + 1, ColumnIndex] = row[col.ColumnName];
    worksheet.StandardWidth = 20.0;
    worksheet.SaveAs(excelFilePath, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue);
    excel.Quit();
    releaseObject(worksheet);
    releaseObject(excel);

    See if this helps.  I opened the old excel file and added the new rows into the existing workbook.
    private void XmlToExcel(string xmlFilePath, string excelFilePath, Boolean append)
    object misValue = System.Reflection.Missing.Value;
    DataSet Trans_ds = new System.Data.DataSet();
    Trans_ds.ReadXml(xmlFilePath);
    Excel.Application excel = new Excel.Application();
    Excel.Workbook Bk = excel.Workbooks.Add(true);
    System.Data.DataTable table = Trans_ds.Tables[0];
    Excel.Worksheet worksheet = (Excel.Worksheet)excel.Worksheets[1];
    Excel.Range excelRange = (Excel.Range)worksheet.get_Range("A" + worksheet.Rows.Count, Type.Missing);
    int lastRow = excelRange.get_End(Excel.XlDirection.xlUp).Row;
    int ColumnIndex = 0;
    int rowIndex = lastRow++;
    foreach (System.Data.DataColumn col in table.Columns)
    ColumnIndex++;
    excel.Cells[lastRow, ColumnIndex] = col.ColumnName;
    foreach (DataRow row in table.Rows)
    rowIndex++;
    ColumnIndex = 0;
    foreach (DataColumn col in table.Columns)
    ColumnIndex++;
    excel.Cells[rowIndex + 1, ColumnIndex] = row[col.ColumnName];
    worksheet.StandardWidth = 20.0;
    if (append == false)
    worksheet.SaveAs(excelFilePath, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue);
    else
    //open old workbook
    Excel.Workbook oldworkbook = (Excel.Workbook)excel.Workbooks._Open(
    excelFilePath,
    Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    Type.Missing, Type.Missing);
    //get first sheet in workbook
    Excel.Worksheet oldxlSht = (Excel.Worksheet)oldworkbook.Worksheets[1];
    //get column A of old worksheet to find last row in sheet
    Excel.Range xlRange = (Excel.Range)oldxlSht.get_Range(
    "A" + oldxlSht.Rows.Count, Type.Missing);
    int LastRow = xlRange.get_End(Microsoft.Office.Interop.Excel.XlDirection.xlUp).Row;
    int newrow = LastRow + 1;
    //get last row of new worksheet
    xlRange = (Excel.Range)worksheet.get_Range(
    "A" + oldxlSht.Rows.Count, Type.Missing);
    LastRow = xlRange.get_End(Microsoft.Office.Interop.Excel.XlDirection.xlUp).Row;
    // copy rows of new worksheet to old worksheet
    xlRange = (Excel.Range)worksheet.Rows["1:" + LastRow, Type.Missing];
    xlRange.Copy(oldxlSht.Rows[newrow, Type.Missing]);
    oldworkbook.Save();
    excel.Quit();
    releaseObject(oldxlSht);
    releaseObject(worksheet);
    releaseObject(excel);
    jdweng

  • Append to existing PDFs-?

    Our company does document imaging, meaning we scan paper and help companies go paperless. One area in which we'd like to move is the area which helps companies stay paperless. We'd like to provide the service of creating forms that can be filled out electronically and signed electronically.
    We currently trying to do this for a medical practice that has a constant flow of new and old patients every day. One thing that they'd like to do is append new charts and whatnot for each patient to existing PDF files. How do we go about doing this? I honestly have no idea how to do this, or what it means.
    Any ideas?

    > One thing that<br />> they'd like to do is append new charts and whatnot for each patient<br />> to existing PDF files. How do we go about doing this? I honestly<br />> have no idea how to do this, or what it means. Any ideas?  <br /><br />You can easily do this with any version of *Acrobat*.<br />Pls see the on the website for the feature list.<br /><br />The "Adobe Reader" is just for *reading* PDFs (as its name says <g>)<br /><br />Rainald

  • How do I correctly append/prepend a description for an AD user?

    I'm still a little new to PowerShell, but experienced enough to be able to search the net and formulate my own script, but I've been stuck on this one part for an entire day now.  Here's what I'm trying to accomplish using PowerShell 4:
    I've already run the following script to produce a list of users in our domain that have not logged into the network for more than 90 days (This is done as a separate requirement of the business):
    search-adaccount -accountinactive -usersonly -timespan "105" | Export-Csv "k:\Inactive90 $(get-date -f yyyy-MM-dd).csv"
    So I have a csv file with the following headers (and data below it, but removed for business privacy):
    AccountExpirationDate Enabled LastLogonDate LockedOut Name ObjectClass ObjectGUID PasswordExpired PasswordNeverExpires UserPrincipalName
    I need to pre-pend the date of disable within the description of the AD user.  The problem that I'm experiencing is that the resultant description that I'm receiving is that the first part of the description is what I expect, where it says
    Last login more than 90 days, Disabled on WHATEVERDATE, but the second part of the description, where I'd expect to see the original description of the AD user, I see this:
    @{Description=PREVIOUS DESCRIPTION TEXT HERE}, so from what I can gather, the original description is getting read as an array, and is thus being output as an array.  So I tried forcing it into a string by putting [string] at the front of the
    $Desc variable.  No dice.
    So the resultant description that I'm currently left with is:
    Last login more than 90 days, Disabled on WHATEVERDATE, @{Description=PREVIOUS DESCRIPTION TEXT HERE}
    I obviously don't want the brackets and @ sign and Description= there.  I'd like it to read as:
    Last login more than 90 days, Disabled on WHATEVERDATE, PREVIOUS DESCRIPTION TEXT HERE
    Below is the code for a script that I've written.  Any help is much appreciated.
    $cred = Get-Credential
    $Date = Get-Date -UFormat %D
    $InactiveUsers = Import-csv ".\test.csv"
    foreach ($User in $InactiveUsers)
    Disable-ADAccount -Identity $User.ObjectGUID -Credential $cred
    $Desc = Get-ADUser -Identity $User.ObjectGUID -Properties Description -Credential $cred | Select-Object -Property Description
    Set-ADUser -Identity $User.ObjectGUID -Credential $cred -Description "Last login more than 90 days, Disabled on $Date, $Desc"

    This should work:
    $cred = Get-Credential
    $Date = Get-Date -UFormat %D
    $InactiveUsers = Import-csv ".\test.csv"
    foreach ($User in $InactiveUsers)
    Disable-ADAccount -Identity $User.ObjectGUID -Credential $cred
    $Desc = Get-ADUser -Identity $User.ObjectGUID -Properties Description -Credential $cred | Select-Object -ExpandProperty Description
    Set-ADUser -Identity $User.ObjectGUID -Credential $cred -Description "Last login more than 90 days, Disabled on $Date, $Desc"
    Instead of
    Select -Property Description
    use
    Select -ExpandProperty Description
    that will give you the actual data of the property instead of what is called a NoteProperty that gives you the brackets.
    I hope this post has helped!

  • Does importing MAX config settings file replace or append the existing MAX entries?

    Hi,
    Does importing a .nce file into max replace the existing config of max with the imported config, or does importing add the new MAX items to the existing MAX items (so that both the "old" and "newly imported" config can be used.
    Solved!
    Go to Solution.

    Either or both! (sometimes neither)
    in the import wizard you can select which items to import and what to do about items that conflict or exist with different information.  (NI really did a nice job - for NI devices!)  for some things (like Pickering VXI devices) you can't import the MAX settings.
    Jeff

  • Help ........ appending to existing spool id

    Hi
    I have a requirement in which i am supposed to use same spool id.
    The problem is i am executing the print program of SMARTFORM and after that i am going to another print program of SAP SCRIPT.
    The print program of smartform is generating a spool id. After this when i am about to print the second sapscript with the addition of new spool id it creates a new spool id and prints the form.
    My requirement is to print both the programs in such a way that it uses the same spool id.
    kindly let me know the possible solutions.
    Imran

    Hi,
    If we try getting the correct spool id from the table TSP01, then which variable of ITCPO mentions the usage of spool id. I had a look at the various structure variables but could not found out the one which mentions the spool id.
    Kindly mention the structure variable in ITCPO

  • Datapump : How to append data in an existing table

    Hello Everyone,
    We are new to Datapump.
    We try to extract data from one user/schema and to append it into another user/schema.
    First we tried Tt use the parameter table_exists_action=append during the importation but we receive this error (but the rows are appended):
    ORA-39152: Table "XXXXX"."YYYYY_ZZZ" exists. Data will be appended to existing table but all dependent metadata will be skipped due to table_exists_action of append
    Which I don't expect since the utility have been told to, indeed, append data.
    Next we tried to use CONTENT=DATA_ONLY on exportation and importation but the importation never end.
    How can we append data into a table's user/schema without having an error?
    Best regards.
    Carl

    IGNORE=Y during the import.it does the same operation. if the table already exists,it ignores and proceed with importing/appending data to the tables. same way, they do have indexes=n and constraints=n option.
    both export/import have equivalent options for fitering to our requirement and datapump has one step above classic import in which you can filter upto metadata object as well.

  • How do you Append XML to an existing document?

    Hi there, I need to to append an existing XML document to a new XML document. How is this done?
    Is there an easy way of attaching one XML document to another?
    If not, do I need to parse the existing XML and add it to the new document, element by element?
    My existing XML is received as an input string and I need to include it in the new document.
    Thanks in advance
    Michael

    Hi there, I need to to append an existing XML document
    to a new XML document. How is this done?
    you can use JAXB to do this. unmarshall(), validate() and marshall() belonging to java intepretion of xml document.
    To eloborate further, say u have xml document as
    <book>
    <author>...</author>
    </book>
    JAXB helps u to get java intepretion of xml document by converting it into Book class and Author class.
    And, say u want to add new authors, u need to add Author objects to Book object and then pass Book object to marshall() method.
    The xml document will be appended with the author u added.
    Hope this helps.
    Jatin

  • Append new data with existing one.

    Hi,
    In sql * loader if i want to append the existing data with new one what can be done?
    Shall i use external tables to get the data or is there something i can use.
    plz do suggest me.
    thanks,
    Mandar.

    Thanks for your reply.
    let me elaborate my problem.
    1)load data 2)append 3)into table STATUS_FILE
    me using this syntax.
    I want to add values which are already from other file and just append into this status_file(status_file table doesnt have these fields) what should be done..
    thst why i wrote external tables and i got this hint.
    The EXTERNAL_TABLE=EXECUTE qualifier tells SQL*Loader to create an external table that can be used to load data and then execute the INSERT statement to load the data.
    is it the way to append the already existing data with the new in table status_file.
    Thanks,
    Mandar.

  • Append to AD User Account Description Property

    How do I incoroporate this into the script below. I need to Append/Add to the AD User Accounts' description property
    flagged for disablement with (Dor-Get-Date-IEM).
    #My Script
    cls
    Import-module activedirectory
    $90days = (get-date).AddDays(-90)
    $filepath="C:\Temp\Dormant_Report_$(Get-Date -Format yyyyMMddmm).csv"
    $splatter=@{
         Filter={
              enabled -eq $True
              -and lastlogondate -le $90days                      
              -and (employeeType -like 'E' -or employeetype -like 'C'  -or employeetype -like 'X' -or employeetype -like 'A' -or employeetype -like 'N')
          Property=@(
                      'name',
                      'SurName',
                      'givenName',
                      'description',
                      'employeeType',
                      'employeeID',
                      'extensionAttribute15',
                      'lastlogondate',
                      'passwordlastset'
    $results=Get-ADUser @splatter
    $results | Export-Csv $filepath -NoTypeInformation
    $results | Disable-ADAccount -Whatif

    It will overwrite whatever is currently set in the description field. Here's a quick example of how you can append to the description:
    $user = Get-ADUser testac1 -Properties Description
    Set-ADUser testac1 -Description ($user.Description + " ADD TEXT HERE")
    Don't retire TechNet! -
    (Maybe there's still a chance for hope, over 10,750+ strong and growing)

Maybe you are looking for