This is strange. I am developing a system to audit PC's directly to an SQL database and one of the peices of information we want to gather is who is logging into what machine. I wrote a number of scripts in powershell and because people never
logoff or restart their computers here, I am going to schedule a task through Group Policies to run on each machine for the users who are part of the OU it is assigned. Problem is, as with most large organizations, we sometimes add local user account
with the same username as the person the machine is assigned to just in case something happens. When the task runs, even though I am logged in under my domain account, it tries to execute with my local credentials??? Why? Is there a way to
change this? I hope? My machine is Windows 7 and we are a mixed mode Windows 7/Windows XP org.
Well, I found a way around this issue, by using (gwmi -class win32_computerSystem).username to get the username and using the domain administrator account and credentials for the task.
I think there should at least be a place to break up the username and domain for pushing out local tasks through group policies. Based on further investigating, what happens is that although group policies is a domain centered function, it creates
the local task with essentially the %username% or $env:username variable without any kind of domain reference, thus tricking Windows into thinking it should run the task with the local user credentials.
If I create a basic test task manually, it puts the full credentials in domain\username but with the group policy task it just puts the username field...
Microsoft is conducting an online survey to understand your opinion of the Technet Web site. If you choose to participate, the online survey will be presented to you when you leave the Technet Web site.