June 2007 Archives

WMI & LotusScript

| No Comments

In LotusScript, to create WMI Object, then setting default print and getting printer size.

Dim objWMIService As Variant
Dim colInstalledPrinters As Variant
Dim objInstances As Variant
strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer")
n = 0
Forall objPrinter In colInstalledPrinters
Redim Preserve pArray(n) As String
pArray(n) = objPrinter.Name
n = n + 1
End Forall

PrinterPath = ws.Prompt(4,"請選擇印表機","請從下列清單選擇所要使用的印表機:","",pArray)
If Cstr(PrinterPath)="" Then Exit Sub

Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Name =" & "'" & PrinterPath & "'")
Forall objPrinter In colInstalledPrinters
Call objPrinter.SetDefaultPrinter()
End Forall
Set objInstances = objWMIService.InstancesOf("Win32_PrinterConfiguration",48)
Forall objInstance In objInstances
If objInstance.name = PrinterPath Then
Msgbox objInstance.Orientation
Msgbox objInstance.PaperSize
End If
End Forall

WMI is very Powerful, even control your PC.

Microsoft: WMI Reference

iSCSI_Target.jpg
雖然SAMBA Server已達到相似的需求,但仍需要透過事先的格式化及設定才能使用。但iSCSI就跟本機磁碟一樣,可自行格式化,只需安裝好iSCSI Initiator。
步驟:
1.Server端(Linux),安裝iSCSI Target,iSCSI Enterprise Target
2.Client端(Windows),安裝iSCSI Initiator,Microsoft iSCSI Software Initiator Version 2.04
3.Client端(Linux),安裝iSCSI Initiator,Open-iSCSI or Linux-iSCSI
這樣就可以讓Windows和Linux直接存取iSCSI Target上的磁碟機。
而為何要iSCSI,因為chm格式的電子書,如果透過網芳共享時,是無法讀到內容,以至於Google Desktop Search沒法針對內容作分析,改用iSCSI方式可以解決這樣的問題。

A Quick Guide to iSCSI on Linux

October 2008

Sun Mon Tue Wed Thu Fri Sat
      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  

Archives

Pages

Powered by Movable Type 4.21-en

About this Archive

This page is an archive of entries from June 2007 listed from newest to oldest.

May 2007 is the previous archive.

July 2007 is the next archive.

Find recent content on the main index or look in the archives to find all content.