вторник, 9 ноября 2010 г.

Windows сетевые диски и принтеры

Использование команды Net Use для подключения или отключения диска

Вы можете использовать команду net use для пакетных файлов и сценариев, чтобы подключить или отключить диск:
  • Чтобы подключить сетевой диск:
    1. Нажмите Пуск (Start), затем щелкните Выполнить (Run).
    2. В окне Открыть (Open), наберите cmd.
    3. Наберите net use x: \\имя компьютера\имя общего ресурса, где x: имя диска, которое Вы хотите назначить на общедоступный ресурс.
  • Чтобы отключить подключенный диск:
    1. Нажмите Пуск (Start), затем щелкните Выполнить (Run).
    2. В окне Открыть (Open), наберите cmd.
    3. Наберите net use x: /delete, где x: имя диска общедоступного ресурса.

Подключение сетевого принтера
Воспользуйтесь командой net.exe для установления постоянного соединения. Для этого используйте в командной строке следующий синтаксис
net use lptx \\сервер_печати\общий_принтер /persistent:yes
где x — номер сопоставляемого порта принтера,сервер_печати — сервер, обслуживающий общий принтер, и общий_принтер — имя общего принтера.

Например, для сопоставления порта LPT2 общему принтеру под названием Laser1 на сервере печати Pserver выполните следующие действия.
  1. Нажмите кнопку Пуск и выберите команду Выполнить.
  2. В поле Открыть введите команду cmd и нажмите кнопку ОК.
  3. Введите команду net use lpt2 \\pserver\laser1 /persistent:yes и нажмите клавишу ВВОД.
  4. В командной строке введите exit и нажмите клавишу «ENTER».
Примечание. В Windows XP пользователи, не обладающие правами администратора, не имеют возможности сопоставить порт LPT пути к сетевому принтеру, если у компьютера имеется реальный параллельный порт.

Дополнительные сведения о сопоставлении портов LPT обычными пользователями см. в следующей статье базы знаний Майкрософт:
313644  (http://support.microsoft.com/kb/313644/ ) Пользователи без прав администратора не могут сопоставить порт LPT сетевому принтеру




Net use
Connects a computer to or disconnects a computer from a shared resource, or displays information about computer connections. The command also controls persistent net connections. Used without parameters, net use retrieves a list of network connections.

Syntax

net use [{DeviceName | *}] [\\ComputerName\ShareName[\volume]] [{Password | *}]] [/user:[DomainName\]UserName] [/user:[DottedDomainName\]UserName] [/user: [UserName@DottedDomainName] [/savecred] [/smartcard] [{/delete | /persistent:{yes | no}}]
net use [DeviceName [/home[{Password | *}] [/delete:{yes | no}]]
net use [/persistent:{yes | no}]

Parameters

DeviceName   : Assigns a name to connect to the resource or specifies the device to be disconnected. There are two kinds of device names: disk drives (that is, D: through Z:) and printers (that is, LPT1: through LPT3:). Type an asterisk (*) instead of a specific device name to assign the next available device name.
\\ ComputerName \ ShareName   : Specifies the name of the server and the shared resource. If ComputerName contains spaces, use quotation marks around the entire computer name from the double backslash (\\) to the end of the computer name (for example, "\\Computer Name\Share Name"). The computer name can be from 1 to 15 characters long.
\ volume   : Specifies a NetWare volume on the server. You must have Client Service for NetWare installed and running to connect to NetWare servers.
Password   : Specifies the password needed to access the shared resource. Type an asterisk (*) to produce a prompt for the password. The password is not displayed when you type it at the password prompt.
/user   : Specifies a different user name with which the connection is made.
DomainName   : Specifies another domain. If you omit DomainName, net use uses the current logged on domain.
UserName   : Specifies the user name with which to log on.
DottedDomainName   : Specifies the fully-qualified domain name for the domain where the user account exists.
/savecred   : Stores the provided credentials for reuse.
/smartcard   : Specifies the network connection is to use the credentials on a smart card. If multiple smart cards are available, you are asked to specify the credential.
/delete   : Cancels the specified network connection. If you specify the connection with an asterisk (*), all network connections are canceled.
/persistent: { yes | no } : Controls the use of persistent network connections. The default is the setting used last. Deviceless connections are not persistent. Yes saves all connections as they are made, and restores them at next logon. No does not save the connection being made or subsequent connections. Existing connections are restored at the next logon. Use /delete to remove persistent connections.
/home   : Connects a user to the home directory.
net help   command   : Displays help for the specified net command.

Remarks

  • Connecting and disconnecting from a network resource
    Use net use to connect to and disconnect from a network resource, and to view your current connections to network resources. You cannot disconnect from a shared directory if you use it as your current drive or an active process is using it.
  • Viewing connection information
    To view information about a connection, you can do either of the following:
    • Type net use DeviceName to get information about a specific connection.
    • Type net use to get a list of all the computer's connections.
  • Using deviceless connections
    Deviceless connections are not persistent.
  • Connecting to NetWare servers
    After you install and run Client Service for NetWare, you can connect to a NetWare server on a Novell network. Use the same syntax that you use to connect to a Windows Networking server, except you must include the volume you to which you want to connect.
  • Using quotation marks
    If the ServerName that you supply contains spaces, use quotation marks around the text (that is, "Server Name"). If you omit quotation marks, an error message appears.

Examples

To assign the disk-drive device name E: to the Letters shared directory on the \\Financial server, type:
net use e: \\financial\letters
To assign (map) the disk-drive device name M: to the directory Mike within the Letters volume on the \\Financial NetWare server, type:
net use m: \\financial\letters\mike
To connect the user identifier Dan as if the connection were made from the Accounts domain, type:
net use d:\\server\share /user:Accounts\Dan
To disconnect from the \\Financial\Public directory, type:
net use f: \\financial\public /delete
To connect to the resource memos shared on the \\Financial 2 server, type:
net use k: "\\financial 2" \memos
To restore the current connections at each logon, regardless of future changes, type:
net use /persistent:yes




 Принтер, подключенный через NET USE, в папке "Принтеры и факсы" НИКОГДА НЕ ПОВЛЯЕТСЯ!!!
Для этого используется скрипт или программа, выполняющая подключение с использованием WMI.
Что-то вроде такого:
код (во всю высоту: 34 строк)

Option Explicit
Dim WSHNetwork, Computer, Path, strComputerDN, objSysInfo, objComputer, sPrintPath, PrintLocation
Dim objWMIService, colInstalledPrinters, objPrinter
Set WSHNetwork = CreateObject("WScript.Network")
On Error Resume Next
Path = WSHNetwork.ComputerName
Set objSysInfo = CreateObject("ADSystemInfo")
strComputerDN = objSysInfo.ComputerName
Set objComputer = GetObject("LDAP://" & strComputerDN)
 
'Назначаем необходимый для установки сетевой принтер
'в зависимости от значения поля Location
Select Case objComputer.Get("Location")
  Case "Отдел 1"
      sPrintPath = "\\server1\HPLaserJ"
      PrintLocation = "Принтер в Отделе 1"
  Case "Отдел 2"
      sPrintPath = "\\server2\HP1100"
      PrintLocation = "Принтер HP1100 Отдел 2"
  Case Else
   MsgBox("Для установки принтера обратитесь к системному администратору.") :WScript.Quit
End Select
 
'Выполняем проверку установленных принтеров
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
 
Set colInstalledPrinters =  objWMIService.ExecQuery _
   ("Select * from Win32_Printer")
   
For Each objPrinter in colInstalledPrinters
 If  PrintLocation = objPrinter.Location  Then
    WScript.Quit
 End If
Next


 не удобно будет менять постояно скрип и прописовать в нем имя принтера
код

PrinterName = InputBox("Insert the Name of the printer to be attached.")




хотелосбы также подключать и принтера,вот вчем вопрос возможно ли ето? лпт принтер возможно, а вот сетевой?
а в чем сложности? нафига он тебе в папке принтов?
Неть, если оно надо, то телодвижения такие:
1) Выбрать локальный порт для подключения (например LPT2), если порт физически существует (обычно это LPT1) - его следует отключить аппаратно (скажем в БИОСе)
2) Подключить к нему сетевой принтер (net use lpt2: \\server\printer /persistent:yes)
3) Выполнить установку локального принтера нужного типа на этот порт

суббота, 6 ноября 2010 г.

radiotray

Болтается в трее и играет радио.

файлы и папки

Есть папка video, нужно установить на неё и содержание разрешения, чтобы никто кроме рута не мог оттуда ничего удалить.

chown root:root -R video
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;

четверг, 4 ноября 2010 г.

RFRemix 14 установка с флешки (USB)

Нужно установить систему на компьютер без оптического привода.
Есть флешка на 8 гигов, разбитая на три раздела.
Поглядим чего получится.
Нашёл у Тигро.
Нужно установить пакет с утилитами
yum install livecd-tools
Идём в папку с образом и от туда
livecd-iso-to-disk RFRemix-14-i386-DVD.iso /dev/sdc1
Заморочка вышла с монтированием и форматирование флешки, т.к. при установке системы, был установлен Гном для "запоглядеть" вместо обыного АйсВМ. И этот Гном не давал штатным путём просто отмонтировать флешку - он её "извлекал", поэтому пришлось из терминала отмонтировать флешку, отформатировать её в ext3, т.к. флешка на 8 гигов, и уже потом заливать на неё установочный образ. Кстати, если на флешке несколько разделов, то их придётся удалить и создать один.