forked from ibeerens/AVD
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChecks.ps1
More file actions
35 lines (30 loc) · 1.09 KB
/
Copy pathChecks.ps1
File metadata and controls
35 lines (30 loc) · 1.09 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
# Get Status
# List PowerState
Get-azvm -Name $avdvms -Status | Select Name,PowerState
# Software confguration
$myCol = @() # Create empty array
ForEach ($sessionhost in $sessionhosts) {
$session = $sessionhost.Name -replace '^[^:]+/'
Write-host $session -ForegroundColor Green
$sessionid = New-Pssession $session
Invoke-Command -Session $sessionid -ScriptBlock {gpupdate /force}
}
# Reboot
Invoke-Command -Session $sessionid -ScriptBlock {
(sleep 10),
(Restart-Computer -Force)
}
Invoke-Command -Session $sessionid -ScriptBlock {
(C:\"Program Files (x86)\F-Secure\PSB\\fs_oneclient_logout.exe" --keycode )
}
# Set Page File
Invoke-Command -Session $sessionid -ScriptBlock {
($pagefile = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges),
($pagefile.AutomaticManagedPagefile = $false),
($pagefile.put() | Out-Null),
($pagefileset = Get-WmiObject Win32_pagefilesetting),
($pagefileset.InitialSize = 4991),
($pagefileset.MaximumSize = 32768),
($pagefileset.Put() | Out-Null),
(Gwmi win32_Pagefilesetting | Select Name, InitialSize, MaximumSize)
}