Jump to content

LunchBox

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by LunchBox

  1. pcstru - thanks for the link, cool script. unfortunately its a little beyond my skill to get the info I need to my mine export errors
  2. Also, I think I want to capture error and googled but I don't know what to look for but this is what I came up this with the cool scrip that ascott2 gave me. Ideally I would like to capture any error but continue with the script to a file like c:\ERROR.TXT (OR CSV) Import-CSV C:\usersphone.csv | foreach{ [color=#ff0000]Try{[/color] Get-ADUser -Filter {(sn -eq $_.Surname) -and (givenName -eq $_.FirstName) -and (samaccountname -eq $_.username)} | Set-ADUSer -OfficePhone $_.OfficePhone [color=#ff0000]}Catch SOMETHING HERE } }[/color]
  3. ascott2 do you import the exported file from AD back into AD? Or how would you make those changes?
  4. Thanks for the reply. I continued googling (while waiting) and found the Import-CSV as one of the options but now my question is this. I exported the CSV and the header is as shown below. The items in green is wha I would like to change. Do I need to leave the entire header of the CSV file or can I remove the items that do not need to be changed? I believe I can tell what I can't delete, should be all in red, the ones in black are ones that I have to need to update and or once that I should of selected in red because they need to stay. objectClass, objectSid, name, telephoneNumber, givenName, whenCreated, objectGUID, primaryGroupID, sAMAccountName, whenChanged, displayName, userPrincipalName, sn, mobile, description, edsvaNamingContextDN, l, company, department, facsimileTelephoneNumber, mail, homePhone, initials, manager, physicalDeliveryOfficeName, pager, postalCode, postOfficeBox, st, streetAddress, title, wWWHomePage I'm assumng that the text in purple are the items that the script will look for in side the CSV file and only update those items? Get-ADUser -Filter {(sn -eq $_.Surname) -and (givenName -eq $_.FirstName) -and (samaccountname -eq $_.username)} | Set-ADUSer -OfficePhone $_.OfficePhone
  5. Wow, quick response (even though I got this Today). My plan is to use a list in a CSV format. My only concern is to match all names for each user, user name, last name and display name. This way we ensure that if there is a change of name by ensuring all name matches there is less chance of error and if one of those do not match then no change is made. Ideally I would like some sort of logic. I can come up with logic with other type of batch files or scripts but not this. I prefer to not start with a tool unless it’s naive to AD. The tool will come later if a script does not work the way it was intended. Although that is a nice tool though.
  6. Greetings, This is my first time visiting this site and I've never heard of it before (I wish I have though). This site seems very well rounded in different IT related fields. I have been given a task (I'm not sure why since we have an AD engineer). We are changing phone numbers through the company and need to do the following Add a phone number to a user who ever had a number or cell number Modify an existing cell number or office number I know that in AD the general tab and telephones tab both have phone numbers. For us under the general tab telephone number and the IP phone number in the telephone tab are the same. I know this can be done via using PowerShell, Scripting or using the LDIFDE command. I know batch files and scripting to a limit. I can piece things together but have been able to google something that will help me. You assistance is greatly appreciated. Thank you
×
×
  • Create New...