TechShizz | All posts tagged 'CMD'

Windows 10 start button or system tray icons are not working

Right I had this issue after migrating a system image from a VM to my phsical laptop.

First thing to try is the System File Checker - Run this as admin. If you can't get CMD open, remember its located at c:\Windows\System32. You could get here by CTRL+R > Type the location > Hit Enter.

sfc /scannnow

If the outcome says that it could not repair the files, either mount the windows 10 ISO or insert the disc and then run this:

Dism /Online /Cleanup-Image /RestoreHealth /source:WIM:F:\sources\install.wim:1

F = the drive letter the media is mounted to.

Then re-run sfc /scannow

If this failes, run PowerShell in admin mode (can be found at C:\Windows\system32\WindowsPowerShell\v1.0\)

Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

At this point my start button and system tray started to work again.


WBAdmin Commands

Run a backup using the current scheduled job settings:
 
Wbadmin start backup -allcritical -backuptarget:B: -quiet
 
Run a system state backup only
 
Wbadmin start systemstatebackup -backuptarget:B:
 
Find backup version
 
Wbadmin get versions
(Ensure that the date taken is the version Identifier)
 
Recover a folder/file from backup (replace file for folder to restore folder)
 
Wbadmin start recovery -version:06/27/2009-09:30 -itemtype:file items:c:\myfile -overwrite:overwrite -recursive -quiet

 

How to create an event in the event log

If you need to create an event in the event viewer when scripting you can use this:

eventcreate /t error /id 100 /l application /d "Create event in application log"
eventcreate /t information /id 1000 /so winmgmt /d "Create event in WinMgmt source"
eventcreate /t error /id 2001 /so winword /l application /d "new src Winword in application log"
eventcreate /s server /t error /id 100 /l application /d "Remote machine without user credentials"
eventcreate /s server /u user /p password /id 100 /t error /l application /d "Remote machine with user credentials"
eventcreate /s server1 /s server2 /u user /p password /id 100 /t error /so winmgmt /d "Creating events on Multiple remote machines"
eventcreate /s server /u user /id 100 /t warning /so winmgmt /d "Remote machine with partial user credentials"

IE8 application errors

If you have probblems with a machine using IE you can try re registering there .dll files. This has solved various things for me before.

regsvr32 c:\windows\system32\urlmon.dll
regsvr32 c:\windows\system32\actxprxy.dll
regsvr32 c:\windows\system32\shdocvw.dll
regsvr32 c:\windows\system32\mshtml.dll
regsvr32 c:\windows\system32\browseui.dll
regsvr32 c:\windows\system32\jscript.dll
regsvr32 c:\windows\system32\vbscript.dll
regsvr32 c:\windows\system32\oleaut32.dll

Add a printer from command line

Here is a handy batch file usful for scripting.

@Echo Off
REM Add printer
rundll32 printui.dll,PrintUIEntry /in /n \\Domain.local\PrinterName
REM Set printer as default
rundll32 printui.dll,PrintUIEntry /y /n \\Domain.local\PrinterName
exit