-
Notifications
You must be signed in to change notification settings - Fork 0
/
ITG.DomainUtils.LocalPrinters.ps1
49 lines (46 loc) · 1.08 KB
/
ITG.DomainUtils.LocalPrinters.ps1
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Function Test-Printer {
<#
.Synopsis
Ïðîâåðÿåò íàëè÷èå îäíîé èëè íåñêîëüêèõ ëîêàëüíûõ î÷åðåäåé ïå÷àòè.
.Inputs
System.Printing.PrintQueue
Î÷åðåäü ïå÷àòè.
.Inputs
Microsoft.Management.Infrastructure.CimInstance
Îáúåêò î÷åðåäè ïå÷àòè, âîçâðàùàåìûé Get-Printer.
.Outputs
System.Bool
Ïîäòâåðæäàåò íàëè÷èå ëèáî îòñóòñòâèå óêàçàííîé î÷åðåäè ïå÷àòè íà ëîêàëüíîì ñåðâåðå ïå÷àòè.
.Link
https://github.com/IT-Service/ITG.DomainUtils.Printers#Test-Printer
.Example
Test-Printer -Name 'P00001'
Ïðîâåðÿåò íàëè÷èå íà ëîêàëüíîì ñåðâåðå ïå÷àòè î÷åðåäè ïå÷àòè ñ èìåíåì P00001.
#>
[CmdletBinding(
HelpUri = 'https://github.com/IT-Service/ITG.DomainUtils.Printers#Test-Printer'
)]
param (
# èäåíòèôèêàöèÿ îáúåêòà PrintQueue - èìÿ "ïðèíòåðà"
[Parameter(
Mandatory = $true
, Position = 1
, ValueFromPipelineByPropertyName = $true
)]
[String]
$Name
)
process {
try {
return [bool] ( Get-Printer `
-Name $Name `
-ErrorAction SilentlyContinue `
);
} catch {
Write-Error `
-ErrorRecord $_ `
;
};
}
}
New-Alias -Name Test-PrintQueue -Value Test-Printer -Force;