0
I'm having trouble getting my runonce command to actually run on login after I promote my server to AD. I've gotten my autologin to work just fine but my registry command won't run on reboot, code below:
Set-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce" `
-Name '!continueADConfig' `
-Value "c:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -WindowStyle Normal -NoLogo -NoProfile -NoExit $scriptpath -primaryNTP $primaryNTP -secondaryNTP $secondaryNTP -rootDomainName $rootDomainName -netBiosName $netBiosName -staticIp $staticIp -subnetPrefix $subnetPrefix -defaultGateway $defaultGateway"
resulting in a runonce !continueADConfig value of c:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -WindowStyle Normal -NoLogo -NoProfile -NoExit C:\Users\Administrator\Documents\promotion.ps1 -primaryNTP 10.230.62.10 -secondaryNTP 10.231.62.10 -rootDomainName example.com -netBiosName mynetbios -staticIp 192.168.5.10 -subnetPrefix 24 -defaultGateway 192.168.5.1
I've checked the runonce key after startup and the values populate correctly, I've even copy/pasted the resulting command into both powershell and cmd.exe with success, it just won't run from the registry. I am running autologin into the domain's administrator account too....
Download
procmon
from sysinternals, enable boot logging, reboot and search if the registry key has been accessed or not. If it has, there's either a problem reading the key or a problem running it. Both cases can be verified from the logging. – Lieven Keersmaekers – 2017-07-19T05:32:40.583C:\Users\Administrator\Documents
might be invisible (or access denied to) in login time. Place thepromotion.ps1
to a commonly accessible folder. – JosefZ – 2017-07-19T14:01:27.387What kinds of folders are commonly accessible? I placed it at the root of c,
C:\
and it still didn't work – comp.sci.intern – 2017-07-24T19:37:01.837