I have created a PowerShell script to create a user in Active Directory, create their home folder and assign their permissions, assign their Office 365 licensing and email various individuals with our organization to tell those individuals they need to do their part to welcome the newcomer. I have also created a Word document that I would like to update and then send on to HR with this individual's specifics to so they would have this to hand to the newcomer on their first day, HOWEVER, I can not figure out how to accomplish this last piece.
I can open the document in PowerShell and I can manipulate the variables in VBA but I can't figure out how to change the variable from within PowerShell. So, for example, the PowerShell script has a variable $username. The Word document has a textbox named username. When I try:
$range.username.text = "$username"
I get an error that tells me:
Property 'Text' cannot be found on this object; make sure it exists and is settable.
I'm sure it is either a formatting error on my part or how I am calling the variables but I have been unsuccessful in finding a good lead in how to resolve this.
Any assistance would be greatly appreciated!
- Moved by George.Zhao CHNMicrosoft contingent staff 6 hours 3 minutes ago