Hello All,
I have a batch file I created not all too long ago that does exactly what I need it to do, but recently, I added another two lines to it, in hopes to rename a computer and this is causing a problem for me. I can run that same exact netdom command using powershell and it works, but if I try to run the following, it completes with an error code 8: insufficient memory. I've isolated the problem by running just the netdom command in a .bat by itself and I get the same thing. If I try to call a rename from a powershell script within a .bat, I don't receive an error code, but the rename doesn't execute. Any ideas what's wrong with my .bat below, more specifically, the last two lines?
for /f %%i in (computerlist.txt) do admod.exe -b cn=%%i,ou=desktops,dc=DOMAIN,dc=com -move ou="toxic test - user",dc=euroinv,dc=com
for /f %%i in (computerlist.txt) do psexec \\%%i -s -i cmd /c (^
xcopy.exe "\\DOMAIN\SYSVOL\DOMAIN\Scripts\DeploymentFiles" "c:\Windows\Temp\DeploymentFiles" /E /I /Y ^
& net user "EastepT" /DELETE ^
& RD "c:\Users\EastepT" /S /Q ^
& cscript //b "C:\Program Files\Microsoft Office\Office14\ospp.vbs" /act ^
& gpupdate.exe /force ^
& netsh.exe advfirewall firewall delete rule name="all" ^
& "c:\Windows\Temp\DeploymentFiles\wol.exe" ^
& powershell.exe "c:\Windows\Temp\DeploymentFiles\Remove-UserProfileReg.ps1" ^
& net stop "Winrm" ^& net start "Winrm" ^
& for /f "skip=2 tokens=2 delims=," %%A in ('wmic systemenclosure get serialnumber /FORMAT:csv') do (set "SERIAL=%%A") ^
& netdom renamecomputer "%%COMPUTERNAME%%" /NewName:"NYC-%%SERIAL%%" /UserD:DOMAIN\AdminAcct /PasswordD:AdminPassword /Force /REBoot ^
)