COMMAND SHELL WINDOWS REBOOT

25 06 2011

A collection of shutdown commands for most DOS and Windows versions and scripting languages.

 

OS (1) Command line Effect Remarks
XP Pro NLTEST /server:localhost /shutdown:"Shutting down, just for fun" 60 Shutdown in 1 minute, displaying the “reason” in a popup Use a remote server name instead of localhost to shutdown that remote server.
XP Pro NLTEST /server:localhost /shutdown_abort Abort the shutdown in progress Use a remote server name instead of localhost to abort a shutdown in progress on that remote server.
XP Pro WMIC OS Where Primary=TRUE Call Shutdown Immediate shutdown Use WMIC’s /NODE switch to shutdown a remote computer.
XP Pro WMIC OS Where Primary=TRUE Call Reboot Immediate reboot Use WMIC’s /NODE switch to reboot a remote computer.
XP SHUTDOWN -r -t 10 Delayed reboot Reboot after a 10 seconds delay.
Can be stopped during those 10 seconds using SHUTDOWN -a
XP SHUTDOWN -s -t 01 Delayed shutdown Shutdown after a 1 second delay, NO poweroff.
XP SHUTDOWN -i Interactive use with GUI Can be used to shutdown multiple computers.
TS LOGOFF 16 /SERVER:termserv1 Logoff Logoff session 16 on Terminal Server TERMSERV1.
Use the QUERY USER command to find out which session ID belongs to whom.
Find more Terminal Server commands.
TS TSSHUTDN 45 /SERVER:termserv1 /POWERDOWN /DELAY:20 /V Delayed poweroff Notify all users on Terminal Server TERMSERV1, logoff all Terminal Server sessions after 45 seconds, wait another 20 seconds, and then shut down Terminal Server TERMSERV1 and power off.
See my Terminal Server Commands page for the exact syntax.
W2K (5) DEVCON Reboot Reboot Requires Microsoft’s DEVCON utility
W2K RUNDLL32 PowrProf.dll, SetSuspendState Activate suspend state
W2K RUNDLL32 USER32.DLL,LockWorkStation Lock Credits: Steven Clements (posted on alt.msdos.batch.nt)
W2K Learn how to shutdown a remote Windows 2000 computer Shutdown GUI, no command line
NT+ (1) PSSHUTDOWN \\mynt4srv -K -F -T 20 Delayed poweroff Poweroff \\mynt4srv after a 20 seconds delay.
Can be aborted using PSSHUTDOWN \\mynt4srv -A
Uses PSSHUTDOWN.EXE from SysInternalsPS Tools.
NT+ (1) PSSHUTDOWN \\myw2ksrv -O -F -T 0 Logoff Immediately logoff console user on \\myw2ksrv
Uses PSSHUTDOWN.EXE from SysInternalsPS Tools
NT4+RK
W2K+RK
SHUTDOWN /L /R /T:0 /Y Reboot Immediate shutdown & reboot
NT4+RK
W2K+RK
SHUTDOWN /L /T:10 /Y /C Delayed shutdown Shutdown in 10 seconds, close without saving.
Can be stopped during those 10 seconds using SHUTDOWN /A
NT4 See Reboot NT on my Solutions found in alt.msdos.batch page Reboot Reboot immediately
NT4 RUNDLL32 USER32.DLL,ExitWindowsEx
RUNDLL32 USER32.DLL,ExitWindowsEx
Logoff Most systems require the command to be called twice before logging off
Win98/ME RUNDLL32 SHELL32.DLL,SHExitWindowsEx n Any n can be any combination (sum) of the following numbers: (4):

0	Logoff
1	Shutdown
2	Reboot
4	Force
8	Poweroff (if supported by the hardware)
Win98/ME RUNONCE.EXE -q Reboot (4)
Win98 RUNDLL32 KRNL386.EXE,exitkernel Poweroff Poweroff for ATX boards only, otherwise normal shutdown (3)
Win9* RUNDLL USER.EXE,ExitWindows Shutdown (2)
Win9* RUNDLL USER.EXE,ExitWindowsExec See Remarks Win95: various results, usualy fast shutdown (and lock PC), sometimes restart Windows, sometimes reboot.
Win98: Restart Windows, sometimes reboot.
Win9* RUNDLL SHELL.DLL,RestartDialog Restart dialog “System Settings Changed, Do you want to restart your computer now?” dialog
Win31* ECHO G=FFFF:0000| DEBUG Task Manager popup And sometimes reboot
DOS ECHO G=FFFF:0000| DEBUG Reboot Warm boot, sometimes cold boot.
May not work with “exotic” memory managers, like Quarterdeck’s QEMM or DesqView; in that case, use RESET.COM instead.
PowerShell Stop-Process -processname * Blue Screen Kills all running processes immediately without confirmation, resulting in a “Blue Screen Of Death”.
KiXtart $RC = SHUTDOWN( "\\server", "Shutting down...", 10, 1, 0 ) Delayed shutdown Shutdown \\server in 10 seconds, with message, close without saving, no reboot
KiXtart $RC = SHUTDOWN( "\\server", "", 0, 1, 1 ) Reboot Immediate shutdown & reboot \\server, without a message
KiXtart $RC = LOGOFF( 1 ) Logoff Forcing applications to close.
Use 0 instead of 1 if you don’t want to force applications to close
KiXtart $RC = SetSystemState( 0 ) Lock Requires KiXtart 4.51 or later
KiXtart $RC = SetSystemState( 1 ) Standby Requires KiXtart 4.51 or later
KiXtart $RC = SetSystemState( 2 ) Hibernate Requires KiXtart 4.51 or later.
KiXtart $RC = SetSystemState( 3, 0 ) Poweroff Power off with prompt to close applications. Use SetSystemState( 3, 1 ) to close applications without prompting.
Requires KiXtart 4.51 or later
Perl InitiateSystemShutdown( $sComputer, $sMessage, $uTimeoutSecs, $bForce, $bReboot ) General syntax (ActivePerl for Windows only)
Perl InitiateSystemShutdown( "", "", 0, 1, 1 ) Reboot Immediate reboot without message, force applications to close without saving data
Perl InitiateSystemShutdown( "", "Going down...", 10, 0, 1 ) Delayed reboot Reboot after 10 seconds, with message and without forcing applications to close
Perl InitiateSystemShutdown( "10.0.1.16", "Sorry", 5, 1, 0 ) Delayed shutdown Shutdown of remote computer after 5 seconds, with message and forced closing of applications
Regina Rexx RC = W32SysShutdown( how [,force] ) General syntax (Regina Rexx for Windows with W32Funcs only).
how can be either Reboot, Logoff, Poweroff or Shutdown.
force can be either Force or Noforce.
Regina Rexx RC = W32SysShutdown( "P", "F" ) Poweroff Immediate shutdown and poweroff, forced closing of application
Regina Rexx RC = W32SysShutdown( "L", "N" ) Logoff Logoff, prompt for saving unsaved data
WSH [1] Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
[2]
[3] for each OpSys in OpSysSet
[4]     OpSys.Reboot()
[5] next
Reboot Requires WMI.
Remove [line numbers].
(Found in a forum posting by Alex K. Angelopoulos on www.developersdex.com)
WSH Replace line 4 in the script above with this one:
[4]     OpSys.Shutdown()
to shut down the PC instead of rebooting it.
Shutdown But no poweroff.

See my WSH page for examples on how to reboot or shut down remote computers too.

WSH [1] Const EWX_LOGOFF   = 0
[2]
[3] Set wmi = GetObject("winmgmts:{(Shutdown)}")
[4] Set objSet = wmi.InstancesOf("Win32_OperatingSystem")
[5]
[6] For Each obj in objSet
[7]     Set os = obj
[8]     Exit For
[9] Next
[10]
[11] os.Win32Shutdown EWX_LOGOFF
Logoff Requires WMI.
Remove [line numbers].
(Posted by Michael Harris on microsoft.public.scripting.vbscript)

My Logoff.vbs combines this code with that of the reboot and shutdown commands, and allows logoff of remote computers as well.

WSH Set objShell = CreateObject( "Shell.Application" )
Shell.ShutdownWindows
Open the Shutdown dialog Based on the Advanced Stuff listing on groups.msn.com/windowsscript/.
OS/2 START /PM SHUTDOWN && EXIT Shutdown Will still stop and ask for confirmation if a non-PM application is active
OS/2 SETBOOT /B Reboot Unconditional shutdown & reboot from default Boot Manager entry.
(Mailed by Rick Curry)
OS/2 SETBOOT /IBD:C: Reboot Unconditional shutdown & reboot from C: drive
OS/2 SETBOOT /IBA:nonsense Shutdown Unconditional shutdown & failing reboot.
Needs Boot Manager installed.
Will reboot, no questions asked, and then stop if nonsense is an invalid Boot Manager menu entry (which, in this case, is exactly what we want).
OS/2 LOGOFF Logoff Both LAN Server client and Peer

 

Notes: (1) DOS MS-DOS or PC-DOS
Win31* Windows 3.1, 3.11 or 3.11 for Workgroups
Win9* Windows 95 or 98
Win98 Windows 98
Win98/ME Windows 98 or Windows Millennium Edition (ME)
NT+ Windows NT 4, 2000 or XP
NT4 Windows NT 4 (not Windows 2000 or XP)
NT4+RK Windows NT 4 with Resource Kit
W2K Windows 2000
W2K+RK Windows 2000 with Resource Kit
XP Windows XP
XP Pro Windows XP Professional and Windows Server 2003
TS Windows NT 4 Terminal Server Edition or Windows 2000 (Advanced) Server with Terminal Server installed
PowerShell Windows XP, Server 2003 or Vista with PowerShell installed
KiXtart Windows (any) with KiXtart
Perl Windows (any) with ActivePerl
Regina Rexx Windows (any) with Regina Rexx and W32Funcs
WSH Windows (32 bits) with Windows Script Host
OS/2 OS/2 Warp 3 and 4, LAN Server and Warp Server
(2) Thanks for Bill James and Tom Lavedas, for the information on RUNDLL.
Find more RUNDLL examples I collected on my RUNDLL page.
(3) Thanks for Sasha Predii for posting this information.
Find more RUNDLL examples I collected on my RUNDLL page.
(4) See article Q234216 in the Microsoft Knowledge base for more information.
Thanks for Alec Soroudi for pointing out this information.
Windows NT also has a RUNONCE.EXE, but I am not sure what its purpose is — RUNONCE.EXE -q does not shut down NT.
(5) Requires Microsoft’s DEVCON utility




Integrated Gmail with CRM Vtiger

13 05 2011

Those of you with GMail accounts will be happy to see that you can now both receive and send emails using your GMail account. vtiger CRM 5.0.4 supports SSL enabled SMTP and IMAP access which is required to use GMail for sending and receiving emails.

For fetching mails from your GMail account, incoming mail settings should be configured as explained in the 5.0.4 release notes (see Page 16).

One of the benefits of using IMAP instead of POP for fetching emails is that your GMail folders (in Gmail these are referred to as labels) will be automatically created in vtiger CRM Webmail client and then kept in sync when changes are made. More details about IMAP can be found here . Please note that the incoming mail only works with PHP 5.2 on Windows.

For sending emails using your GMail account, Outgoing mail server settings should be configured. Please refer to Page 15 in the release notes for more details.

We hope you will find this new feature useful. In case you have any issues/suggestions, please let us know in the comments.





Free SSHD

17 04 2011

freeSSHd and freeFTPd web sites combined into one

Jan 29, 2009 by Kreso

I have put both freeSSHd and freeFTPd on the same web so it’s easier to maintain. Forums are migrated, downloads too, etc..

Version 1.2.2 of freeSSHd put online

Jan 27, 2009 by Kreso

I have put version 1.2.2 with exploit fixes (and few other small things) online for you to try.
Comments welcome, but please do not expect fast answers.

freeSSHd Version 1.2.1 is out

Feb 29, 2008 by Grof

Changelog:

  • ‘freeSSHd NULL Pointer Crash’ bug fixed
  • systray icon is visible only to users with administrator rights
  • port forwarding is more stable
  • added logging for SFTP transfers
  • ‘access denied’ bug is hopefully part of the past
  • and many other little fixes…

Version 1.3.0 will be out soon with more of the requested features, this one was released to address the security issues that emerged recently.

‘edit’ you say????

Jul 01, 2007 by Grof

There’s a new version of freeSSHd online (1.2.0) and it comes with a cool feature you’ve all been waiting for: “graphical” application support. See picture below to better understand what I mean. Here’s a list of changes:

  • new console handling code – supports ‘edit’-like apps, ANSI colors, etc.
  • fix in remote port forwarding that closed listening socket after first connection
  • automatic update support

Doanload Link:

Website : http://www.freesshd.com/

freeSSHd.exe

freeFTPd.exe

freeUserImport.exe





TIPS: 7 Langkah Untuk Mengamankan OpenSSH

17 04 2011

Mengamankan OpenSSH dalam 7 langkah sederhana. Karena ssh adalah salah satu gerbang utama ke linux server Anda, jadi pastikan instalasi openssh Anda sudah aman.

Contoh-contoh yang diberikan dijalankan di linux Ubuntu.

Pilih dan gunakan password yang baik dan aman.

Password yang baik tidak selamanya harus rumit atau panjang sekali. Password yang terlalu rumit justru bisa-bisa membuat kita susah mengingatnya. Gunakanlah kombinasi angka, huruf dan sisipkan beberapa simbol pada password Anda.

Silahkan Anda kreasikan sendiri password yang baik dan aman untuk Anda. Ingat, jangan sekali-kali Anda membuat user: admin/admin, atau test/test (atau username/password lain yang sudah umum dan mudah ditebak) di server yang terhubung langsung ke Internet.

Larang user root untuk login melalui ssh.

Jika tidak ada keperluan khusus, set agar user root tidak bisa login melalui ssh.

Di Ubuntu, edit /etc/ssh/sshd_config, lalu cari baris PermitRootLogin yes (ini adalah konfigurasi default instalasi di Ubuntu), ubah menjadi seperti berikut:

PermitRootLogin no

Setelah itu, pastikan Anda restart service ssh.

sudo /etc/init.d/ssh restart

Batasi pengakses, hanya buka akses untuk IP atau network yang Anda percaya.

Anda bisa membatasi pengakses menggunakan tcpwrapper (hosts.allow, hosts.deny) atau menggunakan iptables.

Contoh penggunakan hosts.allow, hosts.deny untuk membatasi akses ssh hanya boleh dari ip 192.168.22.2 dan hanya untuk network 192.168.23.0/24.

Sunting berkas /etc/hosts.deny

sshd: all

Sunting berkas /etc/hosts.allow

sshd: 127.0.0.0/255.255.255.0 
sshd: 192.168.22.2 
sshd: 192.168.23.0/255.255.255.0

Untuk membuat rules serupa, menggunakan UFW di Ubuntu.

sudo ufw allow proto tcp from 127.0.0.0/24 to any port 22
sudo ufw allow proto tcp from 192.168.22.2 to any port 22
sudo ufw allow proto tcp from 192.168.23.0/24 to any port 22

Silakan Anda baca tulisan lain yang membahas lebih detail mengenai UFW.

Pasang DenyHosts.

Hampir dipastikan, setiap komputer yang terhubung ke Internet sekarang ini rentan terhadap serangan brute force. Jadi penyerang melakukan proses coba-coba login ke sistem dengan menebak username dan password. Si penyerang umumnya memiliki daftar kombinasi username dan password untuk dicobakan ke sistem yang akan diserang.

Dalam beberapa kasus proses coba-coba login ini bisa berhasil, terutama ketika dalam sistem itu ada user yang menerapkan password yang tidak aman (weak password).

Untuk mengurangi efek serangan brute force, Anda bisa menginstal aplikasi denyhosts. Di Ubuntu Anda bisa menginstalnya dari repositori main.

sudo apt-get install denyhosts

Anda mungkin ingin menyunting /etc/denyhosts.conf agar email notifikasi dikirim ke alamat email Anda. Caranya sunting file tersebut, lalu cari baris yang diawali dengan ADMIN_EMAIL, lalu ubah menjadi:

ADMIN_EMAIL = email.anda@domain.com

Konfigurasi lainnya Anda bisa tweak lagi, atau terima default saja (dalam kasus penulis, konfigurasi default sudah cukup baik).

Ganti default port.

Ini mungkin bukan konsep security yang benar-benar baik, tapi trik ini cukup efektif menghindari serangan dari script-script yang menscan ke port 22. Jadi jangan mengasumsikan instalasi openssh Anda sudah aman jika default port Anda ganti. Ini hanya trik untuk menghindari scan ataupun serangan dari cracker pemula.

Caranya, tinggal sunting berkas /etc/ssh/sshd_config, lalu cari baris Port 22, silahkan ganti ke port yang Anda inginkan. Misal,

Port 2222

Jangan lupa untuk merestart service ssh agar konfigurasi baru diterapkan ke sistem.

sudo /etc/init.d/ssh restart

Untuk selanjutnya, Anda bisa mengakses server via ssh ke port 2222. Jika menggunakan perintah ssh, kira-kira seperti berikut:

ssh 192.168.56.101 -l cecep -p 2222

Pasang sistem Port Knocking.

Mungkin dari sekian tips yang diberikan diartikel ini, memasang port knocking adalah tips yang paling rumit. Tapi tips ini cocok jika Anda memang benar-benar paranoid, tidak ingin membuka port 22 atau port lainnya untuk koneksi ssh, tapi Anda tetap ingin bisa mengakses server jika sewaktu-waktu Anda membutuhkan koneksi dari remote komputer.

Silahkan Anda pelajari seputar port knocking ini di website dokumentasi ubuntu.

Selalu update sistem Anda.

Sebetulnya ini adalah aspek pengamanan dasar. Setiap administrator baik di Linux, Windows atau OS lainnya harus rajin mengupdate sistemnya. Karena pada umumnya update terbaru bisa menutup dan memperbaiki celah keamanan yang sudah diketahui sebelumnya.

Di ubuntu, Anda bisa melakukannya dengan satu langkah mudah:

sudo apt-get update && sudo apt-get upgrade




SSH Tunnel di Windows menggunakan Putty

17 04 2011

Jika sebelumnya kita sudah bisa membuat tunnel menggunakan openssh client di linux, sekarang kita akan melakukan hal yang serupa di Windows. Untuk pembuatan tunnel ssh di Windows kita akan menggunakan aplikasi Putty.

Membuat Sock Proxy

Untuk membuat sock proxy, yang perlu Anda lakukan adalah membuka putty, lalu Anda masuk ke menu disamping: Connection -> SSH -> Tunnels. Lalu konfigurasi seperti tampak pada gambar di bawah ini.

sock_proxy_di_putty

Setelah Anda membuat sesi SSH dan terkoneksi ke remote server, tunnel akan terbuka. Langkah selanjutnya adalah mengkonfigurasi aplikasi yang akan menggunakan sock proxy tersebut. Misalnya menggunakan firefox, konfigurasi proxynya adalah seperti di bawah ini:

konfigurasi_proxy_di_firefox

Mengakses Remote Services melalui Tunnel

Misal, Anda menjalankan service squid di remote LAN di komputer dengan IP 192.168.1.1 dan squid dijalankan pada port 3128. Anda ingin membuat tunnel, sehingga Anda bisa mengakses remote squid proxy dari localhost port 3128.

Konfigurasi tunnelnya, bisa Anda dilihat seperti di bawah ini:

local_tunnel_putty

Anda juga bisa berkreasi, dengan mengubah remote IP dan remote port, sehingga Anda bisa mengakses service-service di remote server dari tunnel yang Anda buat.

Opsi Tambahan di Putty

Untuk menghemat penggunaan bandwidth, kita bisa set agar akses ssh di kompresi. Harapannya dengan proses kompresi ini akses menjadi lebih cepat ketika kita mengakses melalui koneksi dengan bandwidth terbatas.

opsi_enable_compression

Biasanya, server ssh akan melakukan proses auto disconnect kepada klien yang tidak melakukan aktifitas (idle) dalam rentang waktu tertentu. Untuk menghindari tunnel Anda terputus karena idle, Anda bisa buat konfigurasi seperti dibawah ini

opsi_to_keep_session_active

Beberapa Tunnel dalam Satu sesi SSH

Untuk satu buah sesi SSH, Anda bisa membuat banyak tunnel sebanyak yang Anda inginkan. Misal Anda buat satu sock proxy di port 8080, akses remote squid proxy di port 3128 dan akses remote terminal server di port 3389.

multi_tunnel

Pada konfigurasi di atas, Anda juga bisa berbagi/share tunnel dengan komputer lain dalam network Anda.








Follow

Get every new post delivered to your Inbox.