Showing posts with label cmd. Show all posts
Showing posts with label cmd. Show all posts

Wednesday, 27 August 2014

Psexec - get SYSTEM rights



download PSExec here





1. copy PseExec to your %WinDir% to have acces everywhere
2. open a CMD
3. psexec -s \\127.0.0.1 cmd

Thursday, 21 August 2014

CMD - Event 4292

Event Type: Error
Event Source: IPSEC
Event Category: None
Event ID: 4292
Date:
Time:
User: N/A
Computer: COMPUTER_NAME
Description:
The IPSec driver has entered Block mode. IPSec will discard all inbound and outbound TCP/IP network traffic that is not permitted by boot-time IPSec Policy exemptions.
Sometimes this solution http://support.microsoft.com/kb/912023 is working and I am also using this

net stop policyagent
regsvr32 polstore.dll
net start policyagent
+ reboot of server and it is working.

CMD - fix WMI

Commands to fix WMI:

%systemdrive%
cd %windir%\system32\wbem
net stop winmgmt /y
if exist repository.old rmdir /s /q repository.old
rename repository repository.old
net start winmgmt

CMD - uninstall windows update specific KB

To remove an update, use the command

wusa /uninstall /kb:2982791 /quiet 

and replace the KB number with the number of the update that you want to remove

CMD - stop / delete service on remoe machine in txt file

@echo off

set LISTFILE=clients.txt

for /f %%a in (%LISTFILE%) do (

    echo.
    echo --------------------------------
    echo.
    echo %%a
    ping -n 1 %%a | find "TTL="
        if not errorlevel 1 (
            echo.
                sc.exe \\%%a stop psexesvc
                sc.exe \\%%a delete psexesvc
            )
        if errorlevel 1 (
            echo %%a unavailable
            )
    )
pause

CMD - kill task on remote machines in txt file

@echo off

set LISTFILE=clients.txt

for /f %%a in (%LISTFILE%) do (

    echo.
    echo --------------------------------
    echo.
    echo. %%a
    ping -n 1 %%a | find "TTL="
        if not errorlevel 1 (
            TASKKILL /s %%a /IM iexplore.exe
            )
    )

pause

CMD - force windows update for all servers in txt file


4 files needed!

start-update.bat
servers.txt
updatehf.bat
updatehf.vbs
psexec.exe

---start-update.bat-----
@echo off

rem set LISTFILE=%1
set LISTFILE=servers.txt

for /f %%a in (%LISTFILE%) do (
    echo.
    echo ---------------------------------------
    echo.
    echo %%a
    ping -n 1 %%a | find "TTL="
        if not errorlevel 1 (
            echo copy updatehf.vbs to %%a
                xcopy c:\temp\updatehf.vbs "\\%%a\c$\temp\" /Y /Q
            echo copy updatehf.bat to %%a
                xcopy c:\temp\updatehf.bat "\\%%a\c$\temp\" /Y | find "0 File"
                if errorlevel 1 (
                    echo open a new cmd for %%a to run updatehf.bat
                    start /min cmd /k ""C:\Windows\psexec.exe" -accepteula -s -w "c:\temp" \\%%a "c:\temp\updatehf.bat" & exit"
                    )
            )
        if errorlevel 1 (
            echo %%a unavailable
            )
    )

----eof---


---updatehf.bat---
cscript c:\temp\updatehf.vbs action:install mode:silent email:youremail@yourdomain.com restart:0
exit

---eof---



---servers.txt---
server1
server2
server3
...
---eof---

CMD - enable remote desktop

local machine


REG.exe ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0

for a remote machine


REG.exe ADD "\\MachineName\HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0