Finding full PC names in AD from csv having only partial PC names

I need to find and remove PCs in csv file from AD. I have only partial names of PCs in csv file.  Is there any way to resolve these partial names in AD to get the full name? For one PC I used these cmdlets which worked fine:
Get-ADComputer -filter {name -like "PC8L080*"} | Remove-ADObject -Confirm:$false
I tried to use Import-Csv cpclist.csv | Foreach-Object{..............
but have problems constructing filter or ldap query :(
Thank you for any help or ideas!
 

OK, not sure why the other method isn't working properly, but this code seems to be working for me
Import-Csv F:\Testing\pcs.csv | Foreach-Object {
$computer = "$($_.Name)*"
Get-ADComputer -filter { Name -like $computer } | Remove-ADObject -Confirm:$false
Now please keep in mind, that if multiple matches are found, then Remove-ADObject will throw an error, if you know that multiple matches will not be found, you will be fine, otherwise, a slight modification will need to be made.
If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
Don't Retire Technet

Similar Messages

  • Unable to read from .csv having field in double quotes

    Hi to all,
    I am trying to reading data from .csv file using JDBC it was reading perfectly when fields are without quotes
    i.e. Field1 and unable to read with filedname as "Field" instead giving Exception Column Not Found, please help me out with this.
    Expecting your responses in this matter.
    Thanks in advance.
    khiz_eng

    So you really read the csv (ASCII) file over JDBC?
    Well, for DSNless connection there's a simple trick:
    1) configure a DSN exactly like your actual (system or user DSN), but as a file DSN.
    This can't be used for JDBC conections, but it contains all the params in a very clear format which you have to set for your JDBC connection just with the same values.
    2) Code your connect string:Connection con = DriverManager.getConnection( "jdbc:odbc:Driver=valueForDriverInFileDSN;Database=valueForDatabaseInFileDSN", user, pw );Look, if you succeed this way.
    If not, please post:
    * your connect string
    * the DBException's informations
    * the content of your FileDSN file

  • Photos from iPhoto are only partially displayed

    Trying to create a slideshow of photos from an Album in iPhoto '08. No need for other layout elements, just want the photos. When I drag a photo from the iPhoto Album into Keynote, it appears as a new slide (using light table view) as expected. But only part of the photo appears. If I go into the individual slide I can select the photo and use the corner handles to resize it to be smaller than the slide. But there are 236 photos I need to put into this show! How can I get Keynote to put each whole photo on the slide? I don't care if they aren't the same shape as the slide and there is empty space left, I just want the whole photo! I tried going into Preferences and checking "Reduced placed images to fit on slides" but that doesn't make any difference. It IS checked and the photos still don't fit. All photos are JPG's.

    There's a bug in iMovie 6 that applies a red tint when importing BMP images — those with the .bmp extension. It occurs only when importing with the Ken Burns checkbox turned ON.
    Save the BMP image as a JPEG before importing to iMovie and all should be fine.
    iPhoto lets you Export the photo to another copy that uses the JPEG format.
    Karl

  • Upload data from excel:can we upload from .csv only?

    Hi Experts,
    Can we upload data from .CSV file only? Is this a limitation in ABAP? What if i have an excel sheet with multiple worksheets and I want to pick data from one of the worksheet. Is this scenario possible?
    Thanks and Regards,
    Rohit

    Hi Rohit.
    In CRM , it works somewhat differently. Following code snippet will help u.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_infile.
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          DEF_FILENAME     = 'p_infile'
          DEF_PATH         = ' '
          MASK             = '*.txt'
          MODE             = '0'
          TITLE            = 'UPLOAD TAB DELIMITED FILE'(078)
        IMPORTING
          FILENAME         = p_infile
    *     RC               =
        EXCEPTIONS
          INV_WINSYS       = 1
          NO_BATCH         = 2
          SELECTION_CANCEL = 3
          SELECTION_ERROR  = 4
          OTHERS           = 5.
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *START-OF-SELECTION
    START-OF-SELECTION.
      gd_file = p_infile.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                    = gd_file
    *   FILETYPE                      = 'ASC'
          HAS_FIELD_SEPARATOR         = 'X'
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    *   NO_AUTH_CHECK                 = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
        TABLES
          DATA_TAB                   = it_record
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        write: 'Error' , sy-subrc .
        skip.
      ENDIF.

  • Getting the local full path name of a file from an item File Browser

    Hi all,
    I would like to get the local full path name, of a file selected from an item 'File browser'.
    I see in wwv_flow_files the column 'name', but actually it's a kind of id like 'F1542335/myFile.gif' for example.
    What i want is the local path of this file ("C:\Documents and Settings\All Users\....\myFile.gif").
    I hope this is possible??
    Anyway, thanks all for reading.
    Ludo

    Hello, thank you for the answer.
    Please understand that I searched before posting, and not ony 15 min.
    What i mean is that the value of a File Browser in an Apex applocation is something like 'F1542335/myFile.gif', but what I need is the local path location.
    And 'F1542335/' is not the local path location, i can't use it. Or maybe there is a way to convert it in a proper path name, such as "C:\Documents and Settings\....", but I don't think so.
    So my question is : how to get the local path name of a file in Apex?
    I'll answer if I find some good things.
    Thanks
    Ludo
    Edited by: user12945874 on 06-avr.-2010 3:59

  • Discoverer Report: How to find Business Area name from Report Name.

    Hi
    I opened a report in Disco Desktop 4 -> Resonsibiolity --> Report Name.
    So I know Report name but don’t know which Business Area it belongs to.
    How to find Business Area Name from Report Name?
    Cheers
    Vijay

    Hi,
    There is no relationship between reports and business areas. Each report can be built from many folders. Each folder can be in many business areas.
    However you can try the following SQL which may give you the result you want for an v5 EUL. You will have to modify for Discoverer 4 EUL:
    select distinct doc_name, obj.obj_name folder_name, bas.ba_name
    from eul_us.eul5_documents doc
    , eul_us.eul5_elem_xrefs xref
    , eul_us.eul5_expressions exp
    , eul_us.eul5_objs obj
    , eul_us.eul5_ba_obj_links bol
    , eul_us.eul5_bas bas
    where xref.ex_from_id = doc.doc_id
    and doc.doc_name = &your_report
    and xref.ex_to_id = exp.exp_id
    and obj.obj_id = exp.it_obj_id
    and bol.bol_obj_id = obj.obj_id
    and bas.ba_id = bol.bol_ba_id
    Rod West

  • How can I find a segment name from p1 and p2 value of v$session??

    Hi, all.
    A session is waiting with "gc cr request".
    The pvalue of the session are as followings.
    p1text p1 p2text p2 p3text p3
    file# 15 block# 412 id# 33619969
    I issued the following sql statement to find the segment name.
    select segment_name
    from dba_extents
    where file_id = 15
    and 412 between block_id and (block_id + blocks -1)
    However, No row returned.
    Is there any mistake??
    Thanks and Regards.

    Hi,
    You will find what the wait means in the Oracle Reference manual.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/toc.htm
    To find out what object P1 refers to:
    select * from v$datafile where file# = file#;
    To find the hot block within that object above do:
    select name, kind from ext_to_obj_view
    where file# = file#
    and lowB <= block#
    and highB >= block#;
    to create a report an example change your variable to what you need
    select
    sess.username,
    sess.sid,
    se.event,
    se.total_waits,
    se.total_timeouts,
    se.time_waited/100 time_waited,
    se.average_wait
    from v$session_event se, v$session sess
    where event like '%buffer busy% <===== change to your choosing
    and sess.sid = se.sid
    and sess.username is not null
    and se.total_waits > 10000
    order by username, sid
    hope this helps.
    al

  • How to find the form name  from VA02 T.code

    how to find the form name  from VA02 T.code

    Hi Rajyam,
    I guess you are looking out for the formname which prints sales related documents.
    If this is what you want,then go to the T-code NACE and select the option K1Sales activities and click on the Output Types button on the top.The new window has all the types of Output types listed.Select the most appropriate and double click on the Processing routines button in the left side screen.
    The new window lists the program names and the forms associated with that output type.
    In case you have any further clarifications,do let me know.
    Regards,
    Puneet Jhari.

  • Spotlight has stopped working properly. Even when a known file is entered (with full file name) in search, it fails to find it. Any ideas?

    Spotlight has stopped working properly. Even when a known file is entered (with full file name) in search, it fails to find it. It finds some things, but is not to be depended upon. Any ideas?

    Try reindexing spotlight: Spotlight: How to re-index folders or volumes - Apple Support
    If you still have problems, open Console app, select All Messages, then search for mds in the search field. Then search for mdworker. See if there are any messages indicating it is having problems with certain files.
    You can also delete the index altogether and cause it to reindex with a command in Terminal. I have always assumed the method above will do the same, but I'm not certain. You must run this command while  logged into an admin account. Copy the whole line and paste it into Terminal.
    sudo mdutil -E /
    sudo temporarily elevates your privileges and will ask for your password. When you type it in, there won't be any response in the Terminal. Just type it and hit return.

  • How to find the dsn name from an *.rpd file provided?

    How to find the dsn name from an *.rpd file provided? All the ODBC details which would require to run your dashboard.

    Hi
    DSN name is not a part of .rpd file. So There is no information about DSN name in .rpd file.
    Thanks
    Siddhartha P

  • Find the full domain names?

    Hi,
    Where can i found the full domain names in application server?
    for example,
    suppose, i am installed in portal, discoverer, etc.,
    http://...:7778/pls/portal
    http://...7781/discoverer/plus
    Thanks!

    Hi,
    You can find your full computer name at My Computer > Properties > Computer name.
    If your machine is not under any domain, as in case of Home PC, then you will have workgroup name instead of domain name.
    You can install portal,discoverer, etc in both cases.
    Cheers!
    Yogini

  • How to find a metachain name from local process chain id or name

    how to find a metachain name from local process chain id or name

    Hi Dwarakanath,
    Please post your query in the correct topic space in SCN.  For help, see this document:
    Find Topic Spaces on SCN (Forums)
    Thanks,
    Kristen

  • Reading Sheet name from csv file.

    Dear All,
    I am doing one program where i am reading contents from .csv file from oracle forms. I m using utl_file for reading the contents from .csv file.
    But problem is i am having 5 sheets under .csv file and i want to read fifth sheet's data. how do i jump to particular sheet in csv file. please help me in this case. this is very urgent.
    regards,
    Manish n

    I'm not sure of the format of a CSV with sheets : I assume it's a spreadsheet with multiple sheets ?
    I know that using Apache POI you can read (and write) native XLS or XLSX spreadsheets and then iterate through the sheets / rows cells. This requires java knowledge but works really well.
    Steve

  • How to find the API name from the Integrator

    I am looking in a WebADI build solution.
    1) I need to find the API name, which is used by the Custom integrator to validate and insert the data into custom table.
    Can we find the source where WebADI integrator stores the API name.
    Please help me out in this.

    Satya,
    You are right that we are not supposed to change the Oracle supplied files. But some times you really don't have any other option. Some times Oracle support them selves ask you to change their programs.
    Anyway the Concurrent program definition is stored in BNE_PARAM_LISTS_B, BNE_PARAM_LISTS_TL, BNE_PARAM_LIST_ITEMS and BNE_ATTRIBUTES table. For a concurrent program with out any parameter there will be 6 records in BNE_PARAM_LISTS_ITEMS and BNE_ATTRIBUTES table.
    These racords are
    Application, Program, Description, Run date , Sub Request , End of Concurrent Request Parameters and Rest of parameters default.
    Look at these tables and you will know how Oracle has defined these Concurrent programs.
    HTH
    Dinesh

  • To find a table name where the field is from??

    Hi Friends...
    I know the field name and now how can I find the table name to which the field belongs....
    Points will be surely awarded...
    Thanks

    Hi,
    To know the master table for the field:
    Go to se11 and give ur field name in the data type selecttion and click on Display.
    Double click on Domain. Goto Value range tab page. In the bottom you can see Value table.
    With rgds,
    Anil Kumar Sharma .P

Maybe you are looking for

  • G/L Account error while posting MIGO: Msg no: 8i195

    Dear Gurus, I am posting MIGO, while posting I am getting the following error msg: 1) G/L a/l 300030 does not exit in the chart of account INT , msg no 8i195, I have created the account 300030 in FS01as MODVAT clearing account, but still I am getting

  • Problems restoring new iphone5s with a backup from a 3gs

    I'm trying to transfer contacts, SMS from an iPhone 3GS to a 5s by restoring the 5s from a backup from the 3GS, but I keep getting a message saying the backup is corrupt or not compatible. I've tried upgrading the iOS on both to the latest version (6

  • So i have a dead pixel on my rMBP does anyone know if apple will replace it or repair it if i take it to the store?

    Its a Late 2013 MBP and its the higher end 16gb ram model Ive only had it a few months so its under the one year warranty, and it had like 1 or 2 really annoying dead pixels. Will apple replace it or repair it if i take it in?

  • Need some info on bootable back-up's

    Aloha: I have already posted this elsewhere and got one reply, but could use a few more to help me decide just where to go on this. I am using Silverkeeper to back up my system on a bootable external hard drive. My hard drive just went south on me an

  • N80/Outlook Calendar/PC Suite

    Not sure whats going on here but I just tried syncing my calendar with the new N80 with the rel 21 of 6.8. I noticed that some of my meetings generated by colleagues in London are out by an hour. I am based in Singapore. Looking through the forums it