-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdos.html
742 lines (513 loc) · 24.3 KB
/
dos.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Pocket Survival Guide - OS</title>
<link rel="stylesheet" href="psg.css" type="text/css">
<LINK REL="SHORTCUT ICON" HREF="favicon.ico" type="image/x-icon"/>
<META NAME="description" content="System Administrator Pocket Survival Guide - A series of notes for Sys Admin"/>
<META NAME="keyword" content="Sys Admin, System Administrator, Solaris, HP-UX, AIX, Linux, Note, Notes, Pocket, Survival, Guide, psg, data center, power, electrical, plug, LYS, LKS, LAPPLAPP"/>
<MEA NAME="Robots" CONTENT="all"/>
<META NAME="Author" CONTENT="Tin Ho"/>
</head>
<body>
<div class="navheader">
<table summary="Navigation header" width="100%">
<tbody>
<tr>
<th colspan="4" align="center"> <A HREF="http://tin6150.github.io/psg/dos.html">Sys
Admin Pocket Survival Guide - Windows/DOS</A></th>
</tr>
<tr>
<td align="left"><a accesskey="h" href="psg.html">Home</a></td>
<td align="center"><a accesskey="s" href="sol.html">Solaris</a></td>
<td align="center"><a accesskey="p" href="hpux.html">HP-UX</a></td>
<td align="right"><a accesskey="a" href="aix.html">AIX</a></td>
</tr>
</tbody>
</table>
<hr></div>
<div class="chapter" lang="en">
<div class="titlepage">
</div>
</div>
<CENTER><IMG SRC="fig/win-error.gif"><BR><I>Ok? Do I have a choice??</I></CENTER>
<BR><BR>
<em>Living with the Evil Empire :)</em>
<A NAME="wsl"></A>
<H1>Windows Services for Linux aka Ubuntu on Win10</H1>
<PRE>
wsl --user root # launch a root session, no need to remember password :P
wsl -d Ubuntu-22.04 --user root # specify a distribution to use
wsl --list # list installed distributions
wsl --set-default Ubuntu-22.04 # set which distro get run for
wsl --update # update wsl... (does this NOT get done as part of windows update?)
</PRE>
<PRE>
WSL is official in Fail Creator Edition of Windows 10 (2017?), avail in Windoze App Store.
It is a Comptatibility Layer, no VM (hardware emulation), no recompilation.
It is like reverse of WINE.
Linux ELF binary is run directly on windows. WSL handles what would normally be linux kernel API calls.
It allows for userland process like bash.
Graphics mode stuff is not stable at this time (2017).
DBUS-X11, the interprocess messaging system in X11, is not avail in WSL at this time.
c:\windows\system32\bash.exe is a PE32+ executable. source code compiled to work on windows.
/bin/bash is ELF LSB executable.
VM is Hardware emulation.
ParaVirtualization is Hardware Emulation, but has extra API calls that allows for Guest OS to interact with paravirtual
layer to run hard-to-execute code directly on host domain env.
Can be better in performance, less translation, but require guest to be ported to utilize the ParaVirtualization API cal
ls (drivers from the ParaVM). eg: Xen hypervisor for Winwdows VM. pv-ops.
ls can behave very differently between wsl/bash vs cygwin, especially for drive mapped by tools like Google Streamd Drive.
old beta:
Ubuntu root "visible" on windows under c:\users\$USERNAME\AppData\Local\lxss\
But changing open files with windows tool would cause permanent data corruption, get file in locked state, and may require reinstall.
This maybe why in fall creator edition, the unix fs portion became an independent sub-system and not visible in windows. (this folder path isn't there anymore, even after unhiding system files).
</PRE>
The bads:
<UL>
<LI>Terminal is based on the DOS prompt window, cut and paste is tedious :(. ^C/^V may be helpful but not inside vim (2018.8)
<LI>No tab support in terminal.
<LI>ConEMU provides multiple tabs. But its far-manager heritage takes getting-used to. Behavior/config maybe changing over time too?
<LI>No way to access linux subsystem files from Windows. I am putting all files on the windows side in /mnt/c/Users.
</UL>
The meh:
<UL>
<LI> create sym links in WSL-bash ("ubuntu shell") (not cygwin or mobaXterm)
<LI> wsl bash create symlinks as unix symlinks. cygwin can understand these.
<LI> cygwin create symlink as NFS link? wsl-bash don't understand these, treat it as a file.
<LI>
</UL>
The decent:
<UL>
<LI>git works for files written to the windows side. file downloaded with Unix LF format remains so. vim will preserve this. Did not invoke UNIX2DOS conversion. Did not need git-for-windows :)
<EM>but git commit/push is having typechange problem, maybe permission...</EM> This could be real problem :(
for now, need to use git from WSL/bash.
<!-- this was edited/saved into /mnt/c/Users/tin/tin-gh/psg/dos.html using vim and git in WSL. git diff showed expected edits. did not mangle any with CR. -->
<LI> Ansible can be installed and it will work as ansible client/target. Well, for now, I am using it with "localhost", so it is not ssh in from some central server. But the Ubuntu is similar enough to say a VM running inside VirtualBox that largely the same playbook can be used in WSL instance.
</UL>
The good:
<UL>
<LI> MS seems to have the heart in a good place (did i really think this??!! :P).
<LI>if the comptability layer keeps up, WSL would actually provide the closest Linux environment short of running a VM. Better than Cygwin, probably better than macOS.
</UL>
Ref:
<UL>
<LI> <A HREF=https://cepa.io/2018/02/10/linuxizing-your-windows-pc-part1/#x-server">cepa article</A> has a very extensive review of WSL.
<UL>
<LI>apt install xfce4-terminal should hopefully be enough and light to add a real linux terminal.
<LI>hyper is a native windows app, maybe look into.
<LI>Cmder vs ConEmu
</UL>
</UL>
<H2>unixy tool comparison in the wsl world</H2>
<PRE>
app: wsl/ubuntu cygwin mobaxterm ConEmu/bash
subsystem: wsl/bash cygwin bash.exe wsl/bash ?
------------- -------------------- ------------------- -------------- -------------------
/bin /bin in wsl fs subsys c:\cygwin\bin C:\Users\....AppData\Local\...\bin
bash /bin/bash, elf64 /usr/bin/bash, PE32 same as wsl/ubuntu
ls /bin/ls, elf64 /usr/bin/ls, PE32 same as wsl/ubuntu
$HOME /home/t (lxfs subsys) C:\cygwin\home\t C\tmp, C\cyg... /home/t || /mnt/c/Users/t [WinHome]
C:\ /mnt/c /cygdrive/c /drvies/c /mnt/c
C:\tin
G:\ /mnt/g, no ls /cygdrive/g /drives/g /mnt/g, no ls (invoked bash from wsl?)
nfs-links NOPE default for ln -s def for ln -s NOPE
unix-links default can handle can handle default
terminal "ubuntu" cygwin-term mobaXterm ConEmu
cut-n-paste ^C/^V ? could be boxy linux-style linux-style far-style?
$TERM xterm-256color xterm xterm xterm-256color
TERM=cygwin needed for arrow keys to work in vi
preference low mostly for config 1st (1st if configured on x1carb)
sudo use win password
pkg apt-get cygwin setup.exe build-in apt-get from wsl
git setup apt-get install git (using wsl) (use wsl)
git config not saved to ~/.git ?? :(
git /usr/bin/git, elf64 /usr/bin/git n/a /usr/bin/git
octave apt-get ins octave, didn't work
</PRE>
Notes
<OL>
<LI> cygwin without WSL may behave differently. cygwin has its own set of tools downloadable from the setup.exe tool
<LI> ConEmu should be just using bash from wsl, thus should behave exactly the same as the ubuntu bash, except for the terminal emulation part.
<LI> apt-get install octave in wsl didn't work. (there is a octave for windows, gui works, the .bat not yet). On mac, "brew install octave" worked very well. plots can launch GUI windows (cocoa? did not need to run X server).
<LI>
</OL>
<H5>Cygwin tweaks</H5>
Expect default home dir to be c:\cygwin\home\$USERNAME
<PRE>
export CygBaseDir="/cygdrive/c"
## $USER expect to be defined automagically, eg "t"
export CygUserBaseDir=${CygBaseDir}/Users/${USER}
ln -s ${CygBaseDir}/tin ./C_tin
ln -s ${CygUserBaseDir} ./WinHOME
ln -s ${CygUserBaseDir}/Desktop .
ln -s ${CygUserBaseDir}/Downloads .
# will run git clone in wsl , files in C:\tin, with sym links in there, no need for action here
ln -s /cygdrive/g ./Gdrv
ln -s /cygdrive/g/My\ Drive/class/MLcoursera .
ln -s /cygdrive/g/My\ Drive/class/MLcoursera_go1 .
</PRE>
<H5>MobaXterm tweaks</H5>
Expect home dir default to C:\temp or some transient location that is lost when program closes. <BR>
Manually change settings to put home dir to be same as cygwin, since it can access /cygdrive/c etc and thus share the sym links...
<BR>
Then don't need to crate any symlinks under Moba settings. Only need to change its home dir.
<!-- C:\moba\$USERNAME maybe best, it use /drives/C, symlink created not usable by WSL. -->
<!--
<PRE>
## $USERNAME expect to be defined automagically by mobaXterm, eg "t"
ln -s /cygdrive/c/cygwin/home/${USERNAME} ./cyg_T
export BASEDIR="/drives/c"
export UserBaseDir=${BASEDIR}/Users/${USERNAME}
# ln can copy-n-paste from cygwin above
# or just use links in cyg_T
</PRE>
-->
<H5>Ubuntu bash (WSL) tweaks</H5>
Expect default home dir to be some obscure/inaccessible place mounted as /home/$USERNAME
<PRE>
export WslBaseDir="/mnt/c"
export UserBaseDir=${WslBaseDir}/Users/t
ln -s ${WslBaseDir}/tin ./C_tin
ln -s ${UserBaseDir} ./WinHome
ln -s ${UserBaseDir}/Desktop .
ln -s ${UserBaseDir}/Downloads .
# git repo is setup here, run psg/git.setup.gh.sh in wsl/ubuntu bash prompt
# stored in C:\tin
# with unix links here (cygwin generate ntfs-based links not usable here)
[[ -e tin-gh ]] || ln -s ${WslBaseDir}/tin/tin-gh ./tin-gh # git.setup.gh.sh may have set this up already
</PRE>
<H5>ConEmu tweaks</H5>
<UL>
<LI> Expect default home dir to be /mnt/c/Users/$USER # ie Windows Home dir for active user
<LI> Import .xml config file with desired copy-n-paste, space, multiline dealing, etc (eg store in SkyDrive)
</UL>
<PRE>
ln -s /mnt/c/tin ./C_tin
</PRE>
<H2>"Single User" recovery mode for WSL</H2>
<PRE>
stop all user level instance of wsl (ie, stop all bash process).
Preview/Beta C:\> lxrun /setdefaultuser root
Fall Creator C:\> ubuntu.exe config --default-user root
bash # this will get into elevated mode, but only after all user-level process have stoped
ubuntu run vi /etc/passwd
ubuntu run id
ubuntu /?
To return back to normal user mode:
ubuntu config --default-user jane
</PRE>
ref: <A HREF="https://msdn.microsoft.com/en-us/commandline/wsl/user_support">ms doc</A>.
<A NAME=xserver></A>
<H2>Xserver</H2>
WSL doesn't provide an X-server. So, like the old days, a windows based X server software is needed. <BR>
Have not tried to run vncserver, but DBUS isn't avail, gnome-session has been reported not to work. Maybe some old school Desktop Env that does not use DBUS may work. Not sure if LXDE uses DBUS. twm should not :) <BR>
<A HREF="https://github.com/QMonkey/wsl-tutorial">QMonkey at github</A> has instructions to use xfce, even have way to fix DBUS error. Will also need to fix fonts (including unicode and chinese), but implies it has gotten to work.
<A HREF="https://virtualizationreview.com/articles/2018/01/30/hands-on-with-wsl-graphical-apps.aspx">Fenton's article</A> reports x11-apps (xeyes), blockout2, works. firefox works but no a/v. vlc complains, but may have hacks.
<UL>
<LI>vcXsrv - small package. Compiled by VC++. Referred by QMonkey and other.
<LI>Xming - Latest version is not entirely free anymore. maybe a tad slower than vcXsrv.
<LI>Cygwin X - may come with the full Cygwin env, which maybe big for system using WSL or Git-for-windows.
<LI>
<LI>Exceed (moneyware)
</UL>
See also <A HREF="vnc.html#XinWin">vnc.html</A>
<H1>Unix-fying Windows/DOS, from Windows 7 days</H1>
<OL>
<LI><A HREF="http://www.cygwin.com/">Cygwin</A> add a lot of standard unix tools, libraries, etc. Includes a bash shell and X Window Manager for running X-based (GUI) apps. It even has GNOME, KDE, keepassx (Qt), tetris!<BR>
<PRE>
add this to PATH system variable
c:\cygwin\bin;c:\cygwin\sbin;c:\cygwin\usr\bin;c:\cygwin\usr\sbin;
modern cygwin creates .bashrc in user's home dir and source that, so PATH can be setup there.
A somewhat yum-like feature to add new packages, eg python:
setup-x86_64.exe -P python
it still run the GUI, but then the python package is selected,
so can just click next/next/next to complete.
setup-x86_64.exe -M -P wget,curl,dog,openssh,ctorrent,openldap,nc,rsync
-M will skip many GUI prompt and go right into the package selection window.
openssh is for both client and server?
openldap is for the client portion only
apt-cyg (not fully stable) may provide an apt-get like command interface to install packages, one at a time.
wget http://raw.github.com/transcode-open/apt-cyg/master/apt-cyg
chmod +x apt-cyg
mv apt-cyg /usr/local/bin
apt-cyg install nano
apt-cyg install git
apt-cyg install ca-certificates
</PRE>
<LI><A HREF="http://www.mkssoftware.com/">MKS Toolkit</A>. This actually pre-date cygwin, but this is moneyware.
<LI><A HREF="http://www.microsoft.com/technet/interopmigration/unix/sfu/default.mspx">SFU</A> Microsoft Services for Unix. Add NFS client and server, telnet server, and other tools to bridge Unix and Windows machines. In the same manner that Samba teaches Unix to talk Windows, SFU teaches Windows to talk Unix.
</OL>
<H1>Windows/DOS commands</H1>
<H2>
Key bindings I like
</H2>
Linux adopted most of them, wish the two were even more similar :)
<PRE>
shift win s = screen clipping, copy to clipboard [OneNote config?]
shift alt t = screen clipping, with additional markup tool [win 10 thing?]
PrtScr = Print Screen. But many program now tries to hijack it, so no consistent behavior
- Win 10 default: capture whole screen to clipboard ?
- OneDrive hijack: save to File in OneDrive ?
</PRE>
<!-- content of cmd.dos.ref -->
<H2>
DOS/CLI commands
</H2>
<PRE>
xcopy d:\ z: /s /e /c /f /z /h # xcopy from d: to z: , include sub dir, hidden file, etc.
robocopy s:\source\folder1 d:\destination\folder2 /e /move /copyall /tee /log+:robo.log /w:1 /r:2
# Robust copy, lot of options, separate tool from MS?
# /move = move files and dirs (hopefully not copy and delete if on same FS)
# /copyall = copy NTFS ACL, owner, and audit info also (these are not included by default)
# but if ACL cannot be copied, copy will fail (reported)
# /e = include sub dirs, even if empty
# /tee /log+:robo.log will do a "T" and append to log file
# /w:1 /r:2 = wait 1 sec before retry, max 2 retries
# (good if know waiting won't help unlock file, or will do multi-scan)
#
#
# Note that folder1 itself won't be moved, it is the content inside the folder
# It is more like folder1\* to folder2.
# But folder1 itself will be deleted if /MOVE is used.
# Don't think too much like Unix!
# Additional notes:
# File that cannot be moved (cuz it is locked)
# is not reported as error in summary (but as skipped?).
# But instead of whining and stopping if using the Win Explorer GUI,
# Robocopy will continue to move the next file.
#
# Files created after Robocopy completes its indexing are not touched.
#
# Redirecting output to a log file is good, as it is quite verbose.
# \\unc\path can be used.
#
# files that already exist in the destination are reported as EXTRA
# can be /purge if desired.
cacls = change acl's. NT cli version of solaris setfacl.
compact = file compression util (list, maybe set?)
type file | find /i "string"
# equiv to unix cat file | grep -i string
# the quotes MUST be used or
# find will complain with weired error message!
# /i = case Insensitive grep.
type file | findstr /i "string"
# similar to find above, but different binary...
rdisk = nt4 create emergency recovery disks (erd)
regback = registry backup (add on?)
title any text string desired
Set the DOS CLI window to have the desired title
bgjob prog arg
run bg job inside a telnet session
so that even if telnet goes away, job remains.
There is still probably a nohup.
---
</PRE>
<H3>BATCH script</H3>
Sample .bat file:
<PRE>
@echo off
CLS
assoc .dxp=dxpfile >NULL
REM ftype dxpfile="C:\winnt\system32\notepad.exe" "%%1"
echo.
echo.
echo.
echo.
if exist "C:\Program Files\TIBCO\Spotfire\3.0\Spotfire.Dxp.exe" (
ftype dxpfile="C:\Program Files\TIBCO\Spotfire\3.0\Spotfire.Dxp.exe" "%%1" >NULL
echo "Updated dxp extension for SpotFire 3.0
goto theend
)
if exist "C:\Program Files\TIBCO\Spotfire\2.1\Spotfire.Dxp.exe" (
ftype dxpfile="C:\Program Files\TIBCO\Spotfire\2.1\Spotfire.Dxp.exe" "%%1" >NULL
echo "Updated dxp extension for SpotFire 2.1
goto theend
)
echo "No SpotFire found in standard directory locations, no changes made."
:theend
echo.
echo.
pause
exit 0
</PRE>
<PRE>
variables:
set foo=bar
echo %foo%
:: may need the /A flag to indicate numeric content?
set /A num=123
:: this is a comment
REM this is another comment
</PRE>
eg beauti.bat script.
<PRE>
:: this batch script successfully run beauti java gui on wombat. run from dos prompt
:: (but untested whether windows version of java can correctly save xml file yet)
:: 2022.0803
::
:: BEAST_LIB="$BEAST/lib"
:: #java -Xms64m -Xmx1024m -Djava.library.path="$BEAST_LIB" -jar "$BEAST_LIB/beauti.jar" $*
set BEAST_LIB="C:\Users\tin61\tin-gh-inet-class-only\inet-dev-class\epi_info\BEASTv1.10.5pre_thorney_0.1.0\lib"
:: set BEAST_LIB="BEASTv1.10.5pre_thorney_0.1.0\lib"
java -Xms64m -Xmx1024m -Djava.library.path="%BEAST_LIB%" -jar "%BEAST_LIB%/beauti.jar"
:: # batch file, hopefully run windows java, and don't get problem with beauti not being able to save xml at the end...
</PRE>
<H3>Alternate Data Stream</H3>
<PRE>
echo "main stream" > stream.txt
echo "alternate stream" > stream.txt:ads
not supported in NFS.
Similar stuff on Apple's HFS?
</PRE>
<H3>windows network stuff</H3>
<PRE>
net use R: \\host\share password /user:DOMAIN\USERNAME
map network drive; funky session weireness, watch out use in script
net view
net user USERNAME PASSWORD /add
add user
net statistics server # info about uptime, etc
tracert
nbtstat -n = list all comp (NetBIOS name, WINS)
nbtstat -c = clear the cache
nbtstat -RR = Release and Reregister NetBIOS name with WINS
</PRE>
NetBIOS names can only be 15 chars long. The 16th char encode the NetBIOS Suffix.
<BR>
A list (albeit not comprehensive, at least 4F is not listed) can be found at
<A HREF="http://support.microsoft.com/kb/163409S">
http://support.microsoft.com/kb/163409</A>
<BR>
All code in hex<BR>
00 = Workstation Service<BR>
03 = Manager Service (allow MMC to connect to it?)<BR>
1B = Domain Master Browser, defined for a domain rather than a computer<BR>
1C = Domain Controllers, defined for a domain<BR>
20 = File Server Service<BR>
<BR>
<PRE>
netsh (shell for config of dhcp, ras, wins, routing) [w2k]
runas # kind of like sudo
runas /user:domain\adminUser c:\winnt\system32\cmd.exe # create a dos prompt with admin credentials
c:\"Program Files\Internet Explorer\iexplore.exe" # start IE using the credential of the DOS session (ie admin acc).
set # display system environment
# LOGONSERVER is the Domain Controller the machine is currently talking to
# Other interesting variables displayed by set:
# USERNAME, USERDOMAIN
# PROCESSOR_ARCHITECTURE
----
network browser cmd (some gui stuff) in Resource or Supplement kit.
net config rdr, see network device info, eg NetBT_E100B1
then,
browstat gb NetBT_E100B1
tell which one is the master browser in the network.
browmon
GUI browser monitor. similar to above
browstat status
browstat view NetBT_E100B1 NTDOM1
browstat getpdc NetBT_E100B1 NTDOM1
other obscure stuff, w2k only?
browstat dumpnet
netusers \\computername /history
# see who has logged in to a given machine
mmc # win magement console,
# many plugin, eg computer mgnt
# customizable and store them as .msc file
http://www.windowsnetworking.com/kbase/WindowsTips/Windows2003/AdminTips/Admin/LaunchAdminToolsfromtheCommandLine.html
</PRE>
<H2>nt4 / w2k reousrce pack</H2>
<PRE>
shutdown
\\computer : remote computer to shutdown (local if omitted)
/A : abort shutdown
/R : reboot
/T:xx : wait xx secs (def=30)
msg : message to user of shutdown
/C : force running app to close
</PRE>
<H2>Windows Registry</H2>
<PRE>
reg query HKCR\dxpfile
reg add
reg delete
reg export ROOTKEY/subkey regdump.reg
Did not find command line equivalent of doing find on all fields and repeat using regedit and F3 ...
can't export and do grep either :(
accepted abbreviations (likely in order of decreasing priority):
HKCR HKEY_Classes_ROOT
HKCU HKEY_CURRENT_USER (take precedence over local_machine if there are duplicates)
HKLM HKEY_LOCAL_MACHINE
HKU? HKEY_USERS
HKCC? HKEY_CURRENT_CONFIG
</PRE>
<H2>Windows Startup</H2>
<PRE>
windows program auto load, from registry instead of Startup folder:
regedit
HKLM\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
TLA (likely in order of decreasing priority):
HKCU HKEY_CURRENT_USER (take precedence over local_machine if there are duplicates)
HKLM HKEY_LOCAL_MACHINE
each program has an entry with full path as value, delete individually as needed.
XP has a System Configuration Utility under control panel | help support
section, so that all current startup places are listed and can be turned off via uncheck.
Many of these can be recognized as normal software, but just always run
at startup, which becomes anoying.
Some spyware may also add hooks here, but if they are really good,
spyware may replace legit system file and it will need a tool to check
if it is really spyware or the legit file!
Probably legit programs (could still be replaced by spyware!):
HKLM...Run mobsync.exe /logon. Sync Manager
KHCU...Run ctfmon. Office2003 text2speech [potentially key logger]
Additional crap that is loaded somehow...
C:\Program Files\Common Files\Real\Update_OB\
apperently lot of .dll and .exe which somehow get executed
rnms3270.dll is the realone messanger center crap that do lot of pop up messageging ads. Delete or rename them!
---
Internet MIME programs (may load all the time)
C:\winnt\Downloaded Program Files\
Each control has its own entry, right click and then choose remove
(eg, will see DBFullInst Control for the stupid SpyWare program).
---
</PRE>
SpyBot AntiSpyware program has tool that list all program that will be
loaded up at boot time and allow single click disactivation.
<H2>Hackish way to reset password</H2>
At least for Win 7.
Idea is to replace the sethc.exe program, which is what accessibility invokes, and replace it with cmd.exe
then during login, press shift 5 times or alt sh prtSc to invoke the accessibilty program, get dos prompt instead, and
issue command
<br>
net user geek newPassword
<br>
detailed steps are listed in
<A HREF="http://www.howtogeek.com/96630/how-to-reset-your-forgotten-windows-password-the-easy-way/">
http://www.howtogeek.com/96630/how-to-reset-your-forgotten-windows-password-the-easy-way/</A>
<br>
(replace sethc.exe when done. or maybe not... nice quick shortcut to cmd, but perpetual back door...)
<BR><BR>
<H2>Cool SA tools</H2>
<H6>WinDirStat</H6>
Get it from sourceforge.net, a program that will collect disk stat usage (network share ok),
keep track of subfolder disk usage, and also give aggregate of files type usage
(eg mp3, m4a, avi, pst, zip, etc).
<BR><BR>
<A HREF="http://pdfforge.org">PDF Forge</A> A freeware to generate PDF for windows (freeware version of Acrobat Writer).<BR>
<BR><BR>
<BR><HR>
<div align="CENTER"> [Doc URL: <A HREF=http://tin6150.github.io/psg/dos.html">http://tin6150.github.io/psg/dos.html</A>]
<BR>
(cc) Tin Ho. See
<A HREF=psg.html>main page</A>
for copyright info. <BR>
<HR>
<A HREF="http://www.taos.com"><IMG SRC="banner/taos_banner1.gif" width="728" height="98"></A>
</div>
<div class="sig"><BR>
hoti1<BR>
bofh1</div>
</body>
<!-- Google analytics new tracking code ga.js. Will actually need to add this code to every page for full tracking! (still the case in 2011?) Using my gmail login 2011.0617 updated with code for http://tin6150.github.io/psg/psg.html --> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-4515095-4']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>
</html>