I have a script that looks like this
add-computer -newname XXX -domainname xxxdemo.com -credential administrator
The problem I am having is when I run this as a .PS1 file it doesn't run and says access is denied. When I copy and paste it in a administrator PowerShell it works. Ideas?