So i have a script that i peiced together to add a user to a local admin group but for some reason it works on my windows 7 machine perfectly i move to the windows 10 machine and it errors out. here is the code
Powershell
#This Funtion is for adding any domain user as a local AdminFunctionAdd-DomainUserToLocalGroup{[cmdletBinding()]Param([Parameter(Mandatory=$True)][string]$computer,[Parameter(Mandatory=$True)][string]$group,[Parameter(Mandatory=$True)][string]$domain,[Parameter(Mandatory=$True)][string]$user)$de=[ADSI]“WinNT://$computer/$Group,group”$de.psbase.Invoke(“Add”,([ADSI]“WinNT://$domain/$user”).path)}#end of function#This if statment looks at the switch if its a 1 it adds the user to admin, #set the domain user to login then restarts machine, unless it isnt,#a laptop that meets the requrements....