Showing posts with label cmd. Show all posts
Showing posts with label cmd. Show all posts
Friday, June 12, 2009
Wednesday, June 3, 2009
Generate a command window for each iteration of a loop
rem This is good for those commands that take a lot of time.
rem Each iteration generates a new cmd window
for /l %a in (1,1,10) do start cmd /k psexec \\computer-%a time-consuming.exe
rem Each iteration generates a new cmd window
for /l %a in (1,1,10) do start cmd /k psexec \\computer-%a time-consuming.exe
Keeping track of station numbers with a text file
rem Usually I keep track of the configurations associated with a station by its mac
rem Without the macs, one can keep track of what configuration to use by using a counter
rem
rem This works well with a network or a flash drive
for /f %%a in ('type \\server\share\count.txt') do SET temp=%%a
rem echo %temp%
SET /A temp+=1
echo %temp% > \\server\share\count.txt
rem The counts of count.txt is simply a number and can be used in a script
rem Without the macs, one can keep track of what configuration to use by using a counter
rem
rem This works well with a network or a flash drive
for /f %%a in ('type \\server\share\count.txt') do SET temp=%%a
rem echo %temp%
SET /A temp+=1
echo %temp% > \\server\share\count.txt
rem The counts of count.txt is simply a number and can be used in a script
Tuesday, June 2, 2009
Power configuration from command line with xp
powercfg /setactive "always on"
powercfg /query
powercfg /query
net time commands
net time (time from domain server)
net time /querysntp
net time /set \\another_pc
net time /setsntp:time.apple.com
net time /querysntp
net time /set \\another_pc
net time /setsntp:time.apple.com
Monday, June 1, 2009
VBScript tricks : no logo, filesystem, control blocks, argument
'When running from the console, here is how to hide the logo
cscript //Nologo myscript.vbs
'How to reference an argument
WScript.Arguments.Item(0)
'Here is how to read a file
set f = fso.opentextfile(source, 1,false)
if fso.fileexists(source) then
while not f.atendofstream
inputline = f.readline
msgbox inputline
wend
end if
Monday, April 20, 2009
For loop of death
This is a way to somewhat defend yourself when a process keeps on respawning itself and won't go away. This happens quite a bit when XP gets infiltrated by malware.
for /l %a in (1,1,1000000) do taskkill /im malware.exe /f
Wednesday, August 27, 2008
IT Rant II : Disk Imaging
If you have many computers, then you probably dread the time of year where you have to refresh their configurations. There are so many solutions available, but the ones that work and are simple to use are few and far between. Ghost 11 is not one of those programs, and neither is NetInstall for OS X 10.4.11. Ghost 11 would not clone Windows x64 nor regular XP sp3 (it worked for me before with Vista). I have gotten NetInstall to work in the past, but there was some issue with System Image utility failing to copy files. It looks like Apple has done a half ass job of updating OS X once again. I should have upgraded to Leopard server... I guess it's back to my reliable friend disk utility for restores until that happens.
Recently, my disk masters have reached very great sizes -- 100GB and up. This becomes a matter of give and take, because I want to do all my setups on the master. However, by doing so, I am creating images that are far too large. If I have sample files and/or programs that can be copied later, then this is the thing to do. I can copy the files with for loops like so:
Mac -
for ((i=1;i<21;i++))
do
scp somefile mylogon@station${i}.local:samples #make sure you copy the public key from ssh-keygen
done # to each station in ~/.ssh
Windows-
for /l %a in (1,1,20) do copy samplefile.txt \\station%a\c$\samples
There are all kinds of ways to simplify network tasks, but this still doesn't give us an excuse to procrastinate when building disk images. Try and do everything that is to be cloned in the master. Also, try to save space.
Recently, my disk masters have reached very great sizes -- 100GB and up. This becomes a matter of give and take, because I want to do all my setups on the master. However, by doing so, I am creating images that are far too large. If I have sample files and/or programs that can be copied later, then this is the thing to do. I can copy the files with for loops like so:
Mac -
for ((i=1;i<21;i++))
do
scp somefile mylogon@station${i}.local:samples #make sure you copy the public key from ssh-keygen
done # to each station in ~/.ssh
Windows-
for /l %a in (1,1,20) do copy samplefile.txt \\station%a\c$\samples
There are all kinds of ways to simplify network tasks, but this still doesn't give us an excuse to procrastinate when building disk images. Try and do everything that is to be cloned in the master. Also, try to save space.
Subscribe to:
Posts (Atom)