Windows Commands for MDT and SCCM
Local user renames command:
wmic useraccount where name='Administrator' rename admin
Local user add
net user [username] /del
net user [user name] [Password] /add
net user [user name] /Active:NO/YES
Delete the Shortcut from the all user
del /Q "C:UsersAdministratorDesktoptest"
del /Q "C:UsersDefaultDesktoptest"
del /Q "C:UsersPublicDesktoptest"
del /Q "C:UsersAdministratorDesktoptest"
del /Q "C:UsersDefaultDesktoptest"
del /Q "C:UsersPublicDesktoptest"
RD /S /Q "C:ProgramDataMicrosoftWindowsStart MenuProgramsWindows Virtual PC"
del /q "C:msdia80.dll"
del /q "C:*.txt"
WMI Query (TS)
Select * from Win32_ComputerSystem where MODEL = "2429LD9"
Uninstall the patch
wusa.exe /kb:958559 /uninstall /quiet /norestart
Uninstall the apps
msiexec /x "{E81C6A40-A011-3CDB-9786-69451BCAF8BB}" /QN
Hide the folder and file
@Echo Off
attrib C:MININT +h
attrib C:bootmgr +h
Exit
Copy the folder or file (file should be in the folder)
@Echo off
copy /y "Test.url" "C:ProgramDataMicrosoftWindowsStart MenuPrograms\test.url"
Echo File Copied "%ErrorLevel%"
Exit
Remove the folder and files
cmd /c rmdir c:Utilities /q /s
cmd /c rmdir c:boot /q /s
cmd /c rmdir c:Drivers /q /s
del /q "C:*.txt"
del /q "C:*.log"
Remove the Local user
net user Tempaccount /del
Hibernet and computer sleep
powercfg -change -standby-timeout-ac 20
powercfg -change -standby-timeout-dc 40
powercfg -change -monitor-timeout-ac 30
powercfg -change -monitor-timeout-dc 10
Image version adding
Reg Add "HKLMSoftwareMicrosoftWindowsCurrentVersionOEMInformation" /f /v Model /t REG_SZ /d "Image version 2.0"
Firewall enable
netsh firewall add allowedprogram "C:Program FilesTightVNCvnc.exe" TightVNC ENABLE
netsh firewall add allowedprogram "C:Program Files (x86)LenovoSystem Updatetvsu.exe" "Lenovo System Update" ENABLE
Admin privilege /Rename file name /copy file
@Echo off
takeown /F "C:WindowsResourcesEase of Access Themesbasic.theme"
icacls "C:WindowsResourcesEase of Access Themesbasic.theme" /grant Administrator:F
rename "C:WindowsResourcesEase of Access Themesbasic.theme" basic_old.theme
copy /y "basic.theme" "C:WindowsResourcesEase of Access Themes"
Echo File Copied "%ErrorLevel%"
Exit
DISM
Mounting command
dism.exe /mount-wim /WimFile:D:testtest.wim /index:1 /Mountdir:D:test1
Inject patch
dism.exe /image:D:test1 /add-package /packagepath:D:test2wp
1. Find the index you want to patch: dism /get-wiminfo /wimfile:<path of the Install.wim file>install.wim
2. Mount your WIM file: dism /mount-wim /wimfile:<path of the Install.wim image file>install.wim /mountdir:<path of the mount directory> /index:<index number of the Install.win image file>
3. Extract the contents of the .MSU file you downloaded with 7zip or another tool.
4. Inject the .CAB into the .WIM File: dism /image:<path of the mount directory> /add-package /Packagepath:<path of the expanded hotfix package>
5. Unmount and commit the changes: dism /unmount-wim /mountdir:<path of the mount directory> /commit