Setup: SCCM 2012, OSD Task Sequence, Windows 7 x64
During the build after the computer is named, joined to domain, and processed whatever software it needs, I want to add the computer to an AD group for policies.
Here's the AddComputer2ADGroup.ps1 I have today:
If I run these commands line by line it works
I've ran it with the same credentials as I do when running it line by line (so I know the rights are there)
Any thoughts? I've been banging my head for 2 days....
Its not the cause of your problem but you could get the computer name in a simpler manner
I'm not sure that you need the quotes on these 2 lines
as you've already defined the strings
Your code looks right – I'd suggest putting some debug code into the script to dump the contents of $grouppath and $computerpath so you can see that they are correctly formatted
So I figure it out I did change the script to make those couple of changes you suggested however it was a SCCM trick I needed to do...
I had a step to set the ExecutionPolicy to Unrestricted which didn't take thus the script blowing up
Ron, do you have a copy of the final PowerShell script, I trying to do the same. but no good at PS. Could you send me a copy
You must be logged in to reply to this topic.