CMD komentoja

Samu
Site Admin
Viestit: 22
Liittynyt: 08 Marras 2007 17:08

CMD komentoja

Viesti Kirjoittaja Samu »

-----------------------------------------------------------------------

net group /add testi
Lisää käyttäjäryhmän nimeltä testi.

-----------------------------------------------------------------------

net computer /add \\testi-pc
Lisää testi-pc nimisen tietokonetilin.

-----------------------------------------------------------------------

net user /add testi P@ssword
Lisää testi nimisen käyttäjätilin jonka salasana on P@ssword.

-----------------------------------------------------------------------

Käyttäjien lisääminen batin avulla.
batin sisältö:

net user /add testi1 P@ssword
net user /add testi2 P@ssword
net user /add testi3 P@ssword
net user /add testi4 P@ssword
net user /add testi5 P@ssword
pause

Tallenna .battina ja tuplaklikkaa.
Pause jotta näkee mahdolliset virheet.

-----------------------------------------------------------------------

ldifde -f users.ldf
Exporttaa domainin kaikki käyttäjät c:\users.ldf tiedostoon.
Tiedoston voi avata notepadilla.

-----------------------------------------------------------------------

ldifde -i -f testi.ldf
Käyttäjien Importtaus.

Luo testi.ldf tiedosto c:\
testi.ldf sisältö:

dn: CN=Kokoomus,OU=Puolueet,DC=hallitusdomain,DC=com
objectClass: user
SAMAccountName: Kokoomus
UserPrincipalName: kokoomus@hallitusdomain.com
UserAccountControl: 544

dn: CN=Keskusta,OU=Puolueet,DC=hallitusdomain,DC=com
objectClass: user
SAMAccountName: Keskusta
UserPrincipalName: keskusta@hallitusdomain.com
UserAccountControl: 544

512 normaali käyttäjätili+32 ei salasanaa =544
Lisää http://support.microsoft.com/?kbid=305144 asiasta. Huom! käyttäjän pitää vaihtaa salasana seuraavankirjautumisen aikana.

-----------------------------------------------------------------------

csvde -i -f testi.csv -k
Käyttäjien Importtaus excelin taulukon avulla. (-k ignooraa virheet jos jostain syystä tarpeen)
Excelin autofil hyötykäyttöön.

-----------------------------------------------------------------------
lisää
start->help and support->tools->command-line reference A-Z
eero
Site Admin
Viestit: 329
Liittynyt: 07 Marras 2007 20:17

Postin lähetys komentoriviltä

Viesti Kirjoittaja eero »

I'm often asked how to send an email from a command prompt.
This would be great thing. If I just wanted to send off a
quick message, why bother opening up a complex program like
Outlook. Or suppose I had a batch job running overnight that
built a report as an Excel spreadsheet. I could add code to
email the report and any other message to all administrators
and managers.

Fortunately there are several command line utilities that will
send mail using SMTP (Simple Mail Transfer Protocol). One of
the most popular is POSTIE which you can find at
http://www.infradig.com. The command line version is free for
personal use and not much more for commercial use. There is
also a full version with support for IMAP4, LDAP, List Server
processing, HTML-mail and SSL/TLS.

When you look at the README file, the number of options for
sending mail seem overwhelming. But you really only need a few
basic items to get most jobs done. After you download postie
and extract it to your directory of choice, to send your first
message open a command prompt and type:

Koodi: Valitse kaikki

postie -host:YourSMTPMailServer -to:billg@microsoft.com -from:buzzbreath@brainbuzz.com -s:"Put your subject here" -msg:"What do you have to say for yourself?"
and press Enter. Your message will be mailed to Bill G. with a
subject of "Put your subject here" and the body will say "What
do you have to say for yourself?" What could be easier?
Remember to use "" around phrases or sentences, generally in
your subject and message.

To attach a file, use the -a switch like this:

Koodi: Valitse kaikki

postie -host:YourSMTPMailServer -to:billg@microsoft.com -from:buzzbreath@brainbuzz.com -s:"Put your subject here" -msg:"What do you have to say for yourself?" -a:"e:\my docs\stock\monopoly.zip"
If you want to send your message to multiple people, you can
use separate -to: switches or a single switch separating
addresses with commas. You can also use -cc: and -bcc: just
as you normally would in any other email program.

Suppose you wanted to make your overnight report the body of
the message and not just an attachment? Use the -file: switch.
Just be sure to use the full path.

Koodi: Valitse kaikki

postie -host:YourSMTPMailServer -to:billg@microsoft.com -from:buzzbreath@brainbuzz.com -s:"Put your subject here" -file:"e:\my docs\stock\net worth.txt"
Finally, there are probably many settings, such as your email
host and from address that aren't going to change. Why bother
typing them out everytime? Postie includes a text
configuration file that you can edit to reflect your specific
configuration. Here is a stripped down version we might use:

Koodi: Valitse kaikki

############### POSTIE Configuration File #####################
#
# Uncomment and edit lines to suit...
#
# Put NO in font of a keyword to negate it.
#
POSTIE_PATH e:\postie
FROM jhicks@2dogs.com
SMTP_HOST mail.2dogs.com
NORMAL
REPLY_TO: LANAdmin@2dogs.com
LOG e:\logs\postie.log
# End of file
Save file file as POSTIE.TXT in the same directory as
POSTIE.EXE. To take advantage of it, we will use the -config
switch. Here's how we might use it in our overnight batch file.

Koodi: Valitse kaikki

@echo off
::Overnight.bat
set POSTIE=e:\utils\mail\postie\postie.exe
set REPORT=\\LANSRV01\report$\nightly.xls
set SUBJ="Overnight Report"
set SENDTO=AManager@2dogs.com,BABoss@2dogs.com,SuperTech@2dogs.com
set MSG="Here is the overnight progress report. Please report any errors to me as soon as possible."

REM Run overnight processes
Call f:\overnight\BackIt.bat
Call f:\overnight\CheckIt.bat
Call f:\overnight\CleanIt.bat

%POSTIE% -to:%SENDTO% -s:%SUBJ% -msg:%MSG% -a:%REPORT% -config

REM Clear out variables
set POSTIE=
set REPORT=
set SUBJ=
set SENDTO=
set MSG=

:EOF
postie.zip
Postin lähetys
(597.56 KiB) Tiedosto ladattu 1022 kertaa
Vastaa Viestiin