-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest.ps1
More file actions
56 lines (44 loc) · 1.2 KB
/
test.ps1
File metadata and controls
56 lines (44 loc) · 1.2 KB
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
50
51
52
53
54
55
56
<#
.DESCRIPTION
Just a test. Ignore
AUTHOR
Ben0xA
.PARAMETER sourcefile
The source file to copy to the remote hosts.
.PARAMETER storedhosts
This is for storing hosts from the framework for scheduling.
.NOTES
psfilename=sourcefile
pshosts=storedhosts
#>
Param(
[Parameter(Mandatory=$true,Position=1)]
[string]$sourcefile,
[Parameter(Mandatory=$false,Position=2)]
[string]$storedhosts
)
# Begin Script Flow
#Start your code here.
[PSObject]$hosts = $null
if($storedhosts) {
#The storedhosts have been serialized as a string
#Before we use them we need to deserialize.
$hosts = $PSHosts.DeserializeHosts($storedhosts)
}
else {
$hosts = $PSHosts.GetHosts()
}
Write-Output $hosts
$results = @()
if($hosts.Count -gt 0) {
foreach($h in $hosts) {
$PSStatus.Update("Processing $($h.Name), please wait...")
$copyitm = New-Object PSObject
$copyitm | Add-Member -MemberType NoteProperty -Name "Computer" -Value $h.Name
$copyitm | Add-Member -MemberType NoteProperty -Name "Filename" -Value $sourcefile
$copyitm | Add-Member -MemberType NoteProperty -Name "Status" -Value "It worked!"
$results += $copyitm
}
$PSTab.AddObjectGrid($results, "Test Results")
}
#End Script