Need existing custom script to run with a .csv or .txt file

Hi, Scripting Guys!
I am a very novice novice when it comes to PowerShell -- I'll state that up front. So apologies if the answer to this is really basic. I am trying to use a script written by someone else, where I can simply paste in the script, identify the user by any one
of several attributes, and the magic happens (in this case, all mail attributes in the AD Object are cleared and then the email address is added back in, resetting that object to the point where IDSync can run).  For a single user at a time, it works
perfectly.
.\Reset-MailAccountforIDSync.ps1 -Identity "[email protected]"
My problem is that I have a .csv file with 60 users I need to run this script on, and there's a possibility of other large batches in the future.  How can I convert this single user script into one that can work with a .csv or .txt file?
Thanks, Stormicat/J.L.Newmark

This will do the trick.
$csv=Import-Csv users.csv
foreach($user in $csv){
.\Reset-MailAccountforIDSync.ps1 -Identity $user.Mail
Of course you will have to learn enough to understand that so start here:
http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
¯\_(ツ)_/¯

Similar Messages

  • Why does Livecycle Designer need to lock scripting on objects with children that are fragments??

    Can someone tell me why Livecycle need to lock scripting on objects with children that are fragments??
    I mean, just because I have a fragment (which you can't edit the script for), why does Livecycle need me to NOT edit say the initialise event on the Main form.
    Yes, I can remove my fragments, edit and reinsert.  Also if the event already has a script, I can edit the xml.  But neither of these are terribly convenient.
    Couldn't there be a better way?

    The purpose of the fragment is to create re-usable or standard components. In most cases the fragment is not created by the same person designing the form and they do not want the from designer to modify any part of the fragment (it is a separate XDP file). There may be code in that fragment that relies on the structure that exists. If you have the rights you can always edit the fragment and when your PDF is created the changes will be picked up.
    If you want to be able to modify the fragment while it is in Design mode sounds to me like you want to add a component to the object library. This will allow you to have a reusable piece of a form that you can modify on a form by form basis. To do this simply build the piece that you want. Lasso the entire form and drag it onto the Custom library. When you release it a dialog will pop up allowing you to name your component. Now on any form design you can drag your new component onto the canvas and all methods/properties and code will come with that component (allowing you to modify it for that form as you see fit).
    Note that you can create your own libraries to hold your components if you see fit. Also if you put your libraries on a shared drive, you can share components between Designers.
    Paul

  • How to get all paragraphs style and their fonts of a  indesign file and write all info with para info into txt file with scripting

    how to get all how to get all paragraphs style and their fonts of a  indesign file and write all info with para info into txt file with scriptingstyle and their fonts of a  indesign file and write all info with para info into txt file with scripting

    I write the script this one works
              var par=doc.stories.everyItem().paragraphs.everyItem().getElements();
      for(var i=par.length-1;i>=0;i--)
           var font=par[i].appliedParagraphStyle.name;
            var font1=par[i].appliedFont.name;
             var size=par[i].pointSize;
            WriteToFile (par[i].contents  +   "\r" +  "Style  : " + font  + "\r" +  "FONT1  : " + font1  + "\r" +  "Size  : " + size  + "\r", reportFilePath);
                            function WriteToFile(text, reportFilePath) { 
        file = new File(reportFilePath); 
        file.encoding = "UTF-8"; 
        if (file.exists) { 
            file.open("e"); 
            file.seek(0, 2); 
        else { 
            file.open("w"); 
          file.writeln(text);  
        file.close(); 
    Thanks for all your support

  • How to write csv or txt file through utl_file with UTF-8 Encoding

    Hi All,
    I need your help to write the data from DB to csv or txt file with UTF-8 encoding through utl_file.
    Database character set:AL32UTF8
    Database version:10G
    All the columns in the DB are of varchar2 type.
    Please let me know if there is any way of doing it.

    What was wrong with the info provided in the link(s) given?
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions027.htm#SQLRF00620]

  • Report with Access Database or TXT file

    Dear All,
    I was wondering if someone can help me with the following issue.
    We have created a Crystal Reports XI report which has a Access MDB or Plain Text file as source data (2 different reports; one with MDB connection only and the other one with a Lotus Notes ODBC connection and TXT file).
    The report runs correctly locally and it also runs correctly on the server but as soon as I post the report via the repository folder to the server, it does not work anymore.
    Viewing the report via InfoView gives me a password request while both, the MDB and TXT file are not password protected.
    We have tried to make system DSN and file DSN connections to both the MDB and TXT file but also this ends with a password request which is not defined.
    Did anyone came across this as well? Any idea about a solution?
    Thank you in advance,
    Annique.

    Hi Annique,
    Since this works in CR Designer I'm moving your post to the Business Objects forum.
    It's likely due to BOE servers not having access to the data sources. Make sure you put them in a folder that the WEB server and BOE Servers have access to. To prompt for log on is because we can't find the data files.
    Thank you
    Don

  • How to update a table AUTOMATICALY with data from a .txt file??

    HI ,
    I want to upload data which is in a notepad file and Create a table. This notepad file stores a string of datas. Here, the data comes in to the .txt file every second.
    (The data is actually stored into the notepad file when a program is executed in Processing.js software)
    Is it possible to do the following using APEX ? ?
    1. This table has to be updated automatically once in 2 minutes (I want this completely automatic, no human intervention -- no update buttons)
    2. A report is to be created in a apex application with this table, it should reflect the updates in the table every 2 minutes.
    Is it possible?? give your ideas.. I want to do this soon for my engineering project :) Any help from you is appreciated. :)
    Edited by: user13301695 on 28-Mar-2011 10:09

    And how do you expect your database server to access a local file in your machine ?
    Is the file accessible from outside your machine say inside a webserver folder so that some DB process can poll on the file ?
    Or, is your DB server in the same machine where you have the text file ?
    You will have to figure out the file acess part before automating user interaction or even auto-refreshing.

  • How to save in CSV or TXT file the Powershell script output?

    Hi,
    I am not sure how to expot this to csv/TXT file, should I use export-csv "c:\test.csv" ?
    my code:
    $site = Get-SPSite "http://tst.pg.com/sites/tsta"
    Write-Output("`n" + $site.URL)
    $myweb = $site.AllWebs | where {$_.url -eq $site.url}
    Foreach ($list in $myweb.Lists) 
    if($list.BaseType -eq "DocumentLibrary")
          Write-Output("")
    Write-Output("Doc Library Name:" + $list.Title)                
    Write-Output($list.roleassignments | ft Member,RoleDefinitionBindings -auto)
    }$site.dispose()

    Hi there - If you just want to dump the output as a txt file, how about the following?
    .\yourpowershell.ps1 > output.txt
    Please remember to mark your question as answered and vote it helpful if this solves or helps with your problem. *******************************************************************************************************

  • Problem with nextDouble when reading txt files

    Hello, im very new to java and im trying to read a double number from a text file but I get an error if i dont write int values, for example:
    my txt file:
    John Smith
    32.5part of my Java code:
    out.println(myScanner.nextLine());
    out.println(myScanner.nextDouble());(myScanner read my text file)
    but I get this error:
    Exception in thread "main" java.util.InputMismatchException
    at java.util.Scanner.throwFor(Scanner.java:840)
    at java.util.Scanner.next(Scanner.java:1461)
    at java.util.Scanner.nextDouble(Scanner.java:2387)
    at TeamFrame.<init>(TeamFrame.java:15)
    at Baseball.main(Baseball.java:14)
    Im following the Java for dummies book and according to the book this should work.

    (Please post using the {code} tags - you put {code} at the start of your code and again at the end so that it's readable when it appears here. If nobody has replied to your post you can edit it and put the tags in now.)
    The code you posted doesn't correspond to the data you posted originally.
    Also when you say "nextLine()" the scanner reads and return s a line and it moves to the next line. But when you say "nextInt()" or "nextDouble()" it doesn't move to the next line even when there's nothing but an int or a double on the line it's reading. That's because there is a newline character and the scanner stops just before that.
    The solution is to say nextLine() straight after every nextInt() or nextDouble(). The nextLine() - whose result you just throw away - will move you to the next line.
    You do this in the case of the int you read, but not in the case of the doubles.
    Edited by: pbrockway2 on Jan 3, 2008 12:35 PM
    Posted with regard to:import java.util.Scanner;
    import java.io.File;
    import java.io.IOException;
    public class Baseball {
    public static void main(String[] args) throws IOException {
        Scanner myScanner = new Scanner(new File("C:\\Users\\Dennis\\Documents\\
            JCreator LE\\MyProjects\\first\\Baseball\\src\\
            Hankees.txt"));
        int nrPlayers = myScanner.nextInt();
        myScanner.nextLine();
        for (int num = 1; num <= nrPlayers; num++) {
            String name = myScanner.nextLine();
            double average = myScanner.nextDouble();
    }

  • Need my custom webauth page displayed with HTTP instead of HTTPS

    I have a custom webauth page installed that I am using with web passthrough authentication on my WLC2006 in order to put up a acceptable use policy page.
    The WLC uses HTTPS to display this which causes a security certificate warning to appear if I go with the WLC's own self-signed certificate. Is there a way I can get the WLC to use plain HTTP to display this page instead so I can eliminate the warning?
    I have already tried installing a trusted 3rd party certificate on the WLC, but I have this very strange problem where mucking with the WLC's web authentication certificate in any manner causes all network activity on the WLC to break except for CDP and ARP, essentially leaving the WLC dead. Three weeks of troubleshooting with Cisco TAC has yielded no progress on that front so now I am trying to bypass the need for a security certificate altogether since I really don't need to encrypt my acceptable use policy page.

    The documentation doesn't provide very clear direction, does it?
    To download the WLC's default webauth page, browse to the controller's Security > Web Login Page. Make sure the web authentication type is Internal (Default). Hit the Preview button. Then use your browser's File > Save As... menu item to save the HTML into a file. Edit this to your liking and bundle it and any graphics images up into a TAR archive, then upload via the controller's COMMAND page.

  • Login scripts not running with AnyConnect NAM and ISE 1.2

    I am using AnyConnect 3.1 NAM as my 802.1x supplicant for ISE 1.2.  When users log in with EAP Chaining (User and Machine Auth), the login script seems hit or miss on if it runs to map their drives.  If I uninstall the NAM client, they map drives every time.  I would think that running a login script to map drives is a common scenario and I was wondering if anyone else using AnyConnect NAM was having similar issues or how they were dealing with it.

    I have the same issue and I solve the issue with change these parameters.
    1.- You must change on configuration profile "before user logon". I have 5 seconds
    2.- You must change on configuration profile  "port authentication Exception policy" and you must enable checkbox "enable port exceptions" and select "allow data traffic before authentication"
    3.- You must enable in the option of interface Ethernet Intel on PC "Wait for link" this option It's in "configured advanced of Intel. You must select "on" in this option.
    4.- (this recommendation it was by Cisco) 
    Active Direct GPO has a setting "Computer Configuration\Administrative
    Templates\System\Logon\ Always wait for the network at computer startup and logon" that
    can be enabled to make the logon scripts wait till 802.1x authentication is completed.
    With those changes the logon script run fine.
    Regards
    David.

  • HT1349 First of all, I have just purchased a iMac and I tried installing my Logic Express 9.0 and it won't work. Gives me an error message. I searched the internet and found i need to update it to run with Lion. Tried to download but my SerNum doest work.

    Can anyone help me please. I tried installing my Logic Express 9.0 but it states I need an update. Ok.. great. So i tried to download it via apple.com but my serial number doesn't work. I can't even schedule an appointment with them because I am in Italy now. Can anyone show me how I can fix this proble. Either download the update thtat allows my iMac to run Logic express 9 or get apple.com to help me. Either or would be appreciated.! Thank you!

    Try the following user tip:
    Troubleshooting issues with iTunes for Windows updates

  • Need Power shell script to run on all databases.

    Hi,
    I have a stored procedure to generate report, using power shell script want to get all databases, run stored procedure on each database and generate the results as .csv file, output the file with database name (place it on directory) and  email .csv
    file.
    looking for script, can any one help pls?
    Naveen| Press Yes if the post is useful.

    Can you please share with me the codes
    Naveen| Press Yes if the post is useful.
    Dear N_14
    You can have a look on the followings
    http://www.csharp-station.com/Tutorial/AdoDotNet/lesson07
    http://www.codeproject.com/Articles/415732/Reading-and-Writing-CSV-Files-in-Csharp
    https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage%28v=vs.110%29.aspx
    Best Regards
    mintssoul

  • ITunes scripts not running with 7.7

    The iTunes com object has changed and some programs I use no longer run. Evidently, some methods have either been hidden or eliminated. Does anyone know if this is something that is going to be fixed?
    Also, can anyone point me to documentation of the current com interface.

    I have the same issue and I solve the issue with change these parameters.
    1.- You must change on configuration profile "before user logon". I have 5 seconds
    2.- You must change on configuration profile  "port authentication Exception policy" and you must enable checkbox "enable port exceptions" and select "allow data traffic before authentication"
    3.- You must enable in the option of interface Ethernet Intel on PC "Wait for link" this option It's in "configured advanced of Intel. You must select "on" in this option.
    4.- (this recommendation it was by Cisco) 
    Active Direct GPO has a setting "Computer Configuration\Administrative
    Templates\System\Logon\ Always wait for the network at computer startup and logon" that
    can be enabled to make the logon scripts wait till 802.1x authentication is completed.
    With those changes the logon script run fine.
    Regards
    David.

  • What is the best way to add i18n to an existing custom CMS system (build with C#)?

    I am currently responsible for an existing CMS, built a few years ago with C# .Net and a few clients are requesting to have their website
    in Spanish. The websites are pre-populated with pages from a library and currently the application has no support for i18n. What is the quickest way to allow the client to have his website in Spanish? And what is the best way to allow any language?
    I understand those are two different answers, but I want to plan for future and at the same time provide a quick solution to please the clients.

    I suggest that you move your post to the below asp.net forum for a better assistance on this, this forum is for C# code related issues:
    http://forums.asp.net/
    Fouad Roumieh

  • Only the last account is created when using this script in combination with a CSV

    Hi, I've got a weird problem when using this script:
    $Users = Import-Csv -Delimiter ";" -Path "......csv"  
    FOREACH ($User in $UserList) { $ User }
        $OU = $User.path
        $UPN = $User.UPN
        $Password = $User.password 
        $Detailedname = $User.firstname + " " + $User.Lastname 
        $UserFirstname = $User.Firstname 
        $FirstLetterFirstname = $UserFirstname.substring(0,1) 
        $SAM =  $User.UPN
        $Company = $User.company
        $Description = $User.description
        $AccountExpirationDate = $User.accountexpirationdate
    $params = @{ 'Name'=$Detailedname;
                 'SamAccountName'=$SAM;
                 'UserPrincipalName'=$SAM;
                 'DisplayName'=$Detailedname;
                 'GivenName'=$UserFirstname;
                 'Surname'=$User.Lastname;
                 'AccountPassword'=(ConvertTo-SecureString $Password -AsPlainText -Force);
                 'Enabled'=$True;
                 'PasswordNeverExpires'=$True;
                 'Path'=$OU;
                 'Company'=$Company;
                 'Description'=$Description;
                 'AccountExpirationDate'=$AccountExpirationDate }
    New-ADUser @params
    The CSV file has columns with the name: Lastname;Firstname;Password;Company;Description;UPN;path;AccountExpirationDate
    Script runs without errors, but only creates the last line in the CSV file. Anyone that can help me, of put me in the right direction? Should be great!
    Michiel
    the Netherlands

    Hi Michiel,
    You'll need to move $params and New-ADUser up into the foreach loop.
    EDIT: Also, remove the { $ User } that you have next to the foreach loop. You're also using $Users instead of $UserList.
    EDIT2: Here's a cleaned up version:
    $UserList = Import-Csv -Delimiter ";" -Path "......csv"
    FOREACH ($User in $UserList) {
    $OU = $User.path
    $UPN = $User.UPN
    $Password = $User.password
    $Detailedname = $User.firstname + " " + $User.Lastname
    $UserFirstname = $User.Firstname
    $FirstLetterFirstname = $UserFirstname.substring(0,1)
    $SAM = $User.UPN
    $Company = $User.company
    $Description = $User.description
    $AccountExpirationDate = $User.accountexpirationdate
    $params = @{ 'Name'=$Detailedname;
    'SamAccountName'=$SAM;
    'UserPrincipalName'=$SAM;
    'DisplayName'=$Detailedname;
    'GivenName'=$UserFirstname;
    'Surname'=$User.Lastname;
    'AccountPassword'=(ConvertTo-SecureString $Password -AsPlainText -Force);
    'Enabled'=$True;
    'PasswordNeverExpires'=$True;
    'Path'=$OU;
    'Company'=$Company;
    'Description'=$Description;
    'AccountExpirationDate'=$AccountExpirationDate
    New-ADUser @params
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

Maybe you are looking for