Hello!
In our environment we have separate domain admins accounts for security reasons. I have a powershell script to create an account and sync it with aad, assign o365 license etc., etc. which should be run as domain admin. But html file inside this script should be printed on non-privileged account's printer(not remotely; I use the same PC)
I have 2 accounts:
admin@mydomain.com - this is my domain admin account
user@mydomain.com - this is my account it has no privileges in the domain and i am logged to pc with this account
Script run as admin@mydomain.com i need to print file to user@mydomain.com default printer.
$print_body | Out-File "C:\temp\$name $surname.html"
$word = New-Object -comObject Word.Application
$word.documents.add("C:\temp\$name $surname.html") > $null
$word.PrintOut()
I would like "C:\temp\$name $surname.html" to be printed on my current user's (user@mydomain.com) default printer. Now, script prints file to admin@mydomain.com default printer (which is "Save to PDF"), script prompts the location to save the file.
This is my first question so I beg your pardon if it's stupid or unclear.