Showing posts with label Batch files. Show all posts
Showing posts with label Batch files. Show all posts

Tuesday, August 16, 2011

WMI Fix Batch file to run on multiple systems

@echo off
%windir%\system32\wbem\winmgmt /clearadap
%windir%\system32\wbem\winmgmt /kill
%windir%\system32\wbem\winmgmt /unregserver
%windir%\system32\wbem\winmgmt /reserver
%windir%\system32\wbem\winmgmt /resyncperf
net stop winmgmt /y
if exist %windir%\system32\wbem\repository.old rmdir /s /q %windir%\system32\wbem\repository.old
ren %windir%\system32\wbem\repository repository.old
regsvr32 /s %systemroot%\system32\scecli.dll
regsvr32 /s %systemroot%\system32\userenv.dll
for /f %%s in (‘dir /b /s %windir%\system32\wbem\*.dll’) do regsvr32 /s %%s
for /f %%s in (‘dir /b /s %windir%\system32\wbem\*.mof’) do mofcomp %%s
for /f %%s in (‘dir /b %windir%\system32\wbem\*.mfl’) do mofcomp %%s
net start winmgmt
%windir%\system32\wbem\wmiprvse /regserver

Save above batch file as wmifix.bat and run with the PSexec.exe with below command line

 

psexec @list.txt -c c:\scripts\wmifix.cmd

List.txt


Add list of computers to the list.txt file which you have trouble.

Thursday, May 12, 2011

SMS to SCCM Auto Migration Script

SMS to SCCM Auto Migration Script

 

Copy.bat

 

xcopy /y ccmsetup.exe c:\windows\temp\
xcopy /y ccmclean.exe c:\windows\temp\
xcopy /y install.bat c:\windows\temp\
schtasks /CREATE /SC MINUTE /mo 90 /TN Migration /TR "C:\windows\temp\install.bat" /RU SYSTEM
schtasks /CREATE /SC MINUTO /mo 90 /TN Migration /TR "C:\windows\temp\install.bat" /RU SYSTEM

 

 

Install.bat

 

C:\windows\temp\ccmclean.exe /client /q
C:\windows\temp\Ccmsetup.exe /mp:ServerName SMSSITECODE=Sitecode

SCHTASKS /delete /TN Migration /F

 

 

Advertise the Copy.bat then automatically clients will installing the sccm

Thursday, June 10, 2010

Join the computer silently to the Domain

Join the computer silently to the Domain

 

Or, in the command you want to use:

netdom join /d:mydomain.com Computertobeaddednamehere /ud:mydomain.com\administrator /pd:oil@22

Batch file for loop in other way

echo ***** Are you sure you want to add these accounts? *******
echo *** If not, press CTRL-C to terminate this batch file ***
pause
FOR %%X IN (NT1 NT2 NT3 NT4 NT5) DO NET COMPUTER \\%%X /ADD
FOR %%X IN (NT6 NT7 NT8 NT9 NT10) DO NET COMPUTER \\%%X /ADD
cls
echo ******* Machine Accounts Added ********
pause