How to extract data from a Word form using Powershell

Using Powershell I would like to extract data from a Network Account Request for New Employee Form (Word format) to eventually use that extracted data to automate the creation of new user accounts in Active Directory. The form contains tables, button choices, dropdown menu (including calendar). Any suggestiong to help extracting data? Would it be easier if I modify the current form or create a new form using Excel for example?

Thank you

Hi cloc14007,

While there are many ways to get information out of a Word document, you should be getting a CSV feed from HR. EmployeeId should be mapped to the EmployeeId attribute in Active Directory and then the script would check if an ID exists for that user and then provision or update if necessary. When you using a form, HR is usually sending information to a hiring manager, that is filling out a form and copy and pasting or typing data into the form and that is sent to you. I’m sure there are options on the form to add users to groups, but it would be much better to generate the user from the feed and then process the form pieces. All of this typically leads to misspelled names that generate additional tickets to fix what was requested. I have done a lot of consulting at companies to implement Identity Access Management (IAM), so those are tips from a field pro. To answer your question regarding ways to read the form, I would try XML first just so that you don’t need to have Office or Word installed for the script to work. Office uses a very old sluggish COM object model, so reading it as XML skips dealing with that, but there are links for that as well:

Read as XML:
https://stackoverflow.com/questions/20835177/read-the-word-document-conent-without-using-microsoft-office
Read with COM:

Powershell Modules: