AirV's Blog

Just another blog

Commandes windows

Ajout d’un utilisateur

net user LoginUtilisateur {passwd} /ADD

/comment: »text »
A descriptive comment (48 characters).
/countrycode:nnn
Use the OS country codes to implement specified language files for help and error messages. 0 = default country code.
/expires:{date | never}
Cause the user account to expire. date can be in mm/dd/yy, dd/mm/yy, or mmm,dd,yy format, depending on the /countrycode. Months can be a number, spelled out, or abbreviated with three letters. Use commas or slashes to separate parts of the date (no spaces).
/fullname: »name »
The user’s full name (rather than a username).
/homedir:path
The path for the user’s home directory. The path must exist.
/homedirreq:{yes | no}
Is a home directory required?
/passwordchg:{yes | no}
Can users change their own password? The default is yes.
/passwordreq:{yes | no}
Must a user account have a password? The default is yes.
/profilepath:[path]
The path for the user’s logon profile.
This pathname will be used to store their registry profile.
/scriptpath:path
Path for the user’s logon script. This is relative to %systemroot%SYSTEM32REPLIMPORTSCRIPTS. (The NETLOGON share) You can’t use an absolute path.
/times:{times | all}
The times the user is allowed to use the computer.
The times value is expressed as day[-day][,day[-day]] , time[-time][,time[-time]], limited to 1-hour time increments.
Days can be spelled out or abbreviated (M,T,W,Th,F,Sa,Su).
Hours can be 12- or 24-hour notation. For 12-hour notation, use AM, PM, or A.M., P.M.
The value all means a user can always log on.
A null value (blank) means a user can never log on.
Separate day and time with commas, and units of day and time with semicolons (for example, M,4AM-5PM;T,1PM-3PM).
Do not use spaces when designating /times.
/usercomment: »text »
Add or change the « User comment » for the account. Only Administrators can edit this.
/workstations:{computername[,…] | *}
List as many as eight workstations from which a user can log on to the network.
Separate multiple entries in the list with commas.
If /workstations has no list, or if the list is *, the user can log on from any computer.
Activer le compte administreateur

net user administrator /active:yes

Suppression de répertoire

RD

RD /S /Q toto

Suppression de fichier

DEL

Delete one or more files.

Syntax
DEL [options] [/A:file_attributes] files_to_delete
Key
files_to_delete : This may be a filename, a list of files or a Wildcard

options
/P  Give a Yes/No Prompt before deleting.
/F  Ignore read-only setting and delete anyway (FORCE)
/S  Delete from all Subfolders (DELTREE)
/Q  Quiet mode, do not give a Yes/No Prompt before deleting.

/A  Select files to delete based on file_attributes

file_attributes:
R  Read-only    -R  NOT Read-only
S  System       -S  NOT System
H  Hidden       -H  NOT Hidden
A  Archive      -A  NOT Archive

Wildcards: These can be combined with part of a filename

*  Match any characters
?  Match any ONE character

Changement des droits

CACLS.EXE

Display or modify Access Control Lists (ACLs) for files and folders.

Access Control Lists apply only to files stored on an NTFS formatted drive, each ACL determines which users (or groups of users) can read or edit the file. When a new file is created it normally inherits ACL’s from the folder where it was created.

Syntax
CACLS pathname [options]

Key
options can be any combination of:

/T Search the pathname including all subfolders.
/E Edit ACL (leave existing rights unchanged)
/C Continue on access denied errors.

/G user:permission
Grant access rights, permision can be:
R Read
W Write
C Change (read/write)
F Full control

/R user
Revoke specified user's access rights (only valid with /E).

/P user:permission
Replace access rights, permission can be:
N None
R Read
W Write
C Change (read/write)
F Full control

/D user
Deny access to user.

In all the options above "user" can be a UserName
or a Workgroup (either local or global)

If a UserName or WGname includes spaces then it must
be surrounded with quotes e.g. "Authenticated Users"

cacls.exe toto /C /T /G root:F

Changemnt du propriétaire

chown

cd c:profilestoto
chown -r Administrateurs * (fles and subdirectories)

Liste des commandes vista

http://www.pcinpact.com/