Windows Service Hardening。這種內建規則會限制服務,使其無法以本身設計以外的方式建立連線。服務限制會設定為讓 Windows 服務只能用指定的方式通訊 (例如,允許的流量可能被限制到指定的連接埠)。
參考 : https://technet.microsoft.com/zh-tw/library/cc755191(v=ws.10).aspx
- Crystal_Managed2003.msm (如果有水晶报表)
- dotnetfxredist_x86.msm (.net一定是必须的)
- ... (如果有引用其他的dll)
- VC_User_CRT71_RTL_X86_---.msm
- VC_User_STL71_RTL_X86_---.msm
- 'power by: landlordh
- 'for 2000,xp,2003
- Module uninstall
- Sub Main()
- Dim myProcess As Process = New Process
- If System.Environment.OSVersion. ToString.IndexOf("NT 5") Then
- myProcess.Start("msiexec", "/X {2B65D4A9-C146-4808-AB4B-321F B0779559}") '改为自己的ProductCode
- End If
- myProcess.Close()
- End Sub
- End Module
Public Sub userDefinePrint(sh As Worksheet, sharePath As String, shareName As String, printerName As String)
TryAgain:
On Error Resume Next
Dim printerFullName As String
printerFullName = NetworkPrinter(sharePath & "\" & printerName)
ActivePrinter = printerFullName
If Err.Number <> 0 Then
PrintServer = sharePath & "\" & shareName
Set objNetwork = CreateObject("Wscript.Network")
objNetwork.AddWindowsPrinterConnection (PrintServer)
GoTo TryAgain
End If
With sh.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0)
.BottomMargin = Application.InchesToPoints(0)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.PaperSize = 234
End With
If Err.Number <> 0 Then
sh.PrintOut Copies:=1, Preview:=False, ActivePrinter:=printerFullName, Collate:=True
Else
sh.PrintOut Copies:=1, Preview:=False, ActivePrinter:=printerFullName, Collate:=True
End If
End Sub
Public Function NetworkPrinter(ByVal myprinter As String)
On Error Resume Next
Dim NetWork As Variant
Dim X As Integer
Dim Prt_On As String
Prt_On = " on "
'/// Define NetWork Array \\\
NetWork = Array("Ne00:", "Ne01:", "Ne02:", "Ne03:", "Ne04:", _
"Ne05:", "Ne06:", "Ne07:", "Ne08:", _
"Ne09:", "Ne10:", "Ne11:", "Ne12:", _
"Ne13:", "Ne14:", "Ne15:", "Ne16:", _
"LPT1:", "LPT2:", "File:", "SMC100:")
'Setup printer to Print
X = 0
TryAgain:
On Error Resume Next
'Printer
Application.ActivePrinter = myprinter & Prt_On & NetWork(X)
If Err.Number <> 0 And X < 16 Then X = X + 1 GoTo TryAgain ElseIf Err.Number <> 0 And X > 15 Then
GoTo PrtError
End If
On Error GoTo 0
NetworkPrinter = myprinter & Prt_On & NetWork(X)
errorExit:
Exit Function
PrtError:
'no printer found
NetworkPrinter = ""
Resume errorExit
End Function