disable hibernation

This commit is contained in:
2020-09-17 15:57:43 -04:00
parent 5694bd0842
commit 4545fcd942
2 changed files with 21 additions and 13 deletions
+8
View File
@@ -42,6 +42,14 @@ If ( IsAdmin )
Write-Output "Deleting all temp files not modified in ${OlderThan} day(s) from ${SysTemp}"
ForEach ( $OldTempFile in $OldTempFiles ) { Remove-Item $OldTempFile -Force -Recurse -ErrorAction SilentlyContinue }
}
## Turn off system hibernation if it's in use
If ( Test-Path "${Env:SystemDrive}\hiberfil.sys" )
{
Write-Output "Turning off system hibernation"
Try { Start-Process "powercfg" -ArgumentList "-h off" -Wait }
Catch { Write-Output $_.Exception.Message }
}
}
## Only run this section if we don't have administrative privileges
+13 -13
View File
@@ -5,7 +5,7 @@ param([string]$User)
## Install ExchangeOnlineManagement module if it doesn't already exist
If ( !(Get-Module -ListAvailable -Name ExchangeOnlineManagement) )
{
Try { Install-Module -Name ExchangeOnlineManagement -RequiredVersion 1.0.1 }
Try { Install-Module -Name ExchangeOnlineManagement }
Catch { Write-Output $_.Exception.Message ; Exit }
}
Import-Module ExchangeOnlineManagement
@@ -13,18 +13,18 @@ Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName $User -ShowProgress $true
$Groups = Get-UnifiedGroup -ResultSize Unlimited
$Groups | ForEach-Object {
$group = Get-UnifiedGroupLinks -Identity $_.Name -LinkType Members -ResultSize Unlimited
$group | ForEach-Object {
New-Object -TypeName PSObject -Property @{
Group = $group.DisplayName
Member = $_.Name
EmailAddress = $_.PrimarySMTPAddress
RecipientType= $_.RecipientType
}
}
} | Export-CSV “${Env:UserProfile}\Desktop\group-export.csv" -NoTypeInformation -Encoding UTF8
#$Groups = Get-UnifiedGroup -ResultSize Unlimited
#$Groups | ForEach-Object {
# $group = Get-UnifiedGroupLinks -Identity $_.Name -LinkType Members -ResultSize Unlimited
# $group | ForEach-Object {
# New-Object -TypeName PSObject -Property @{
# Group = $group.DisplayName
# Member = $_.Name
# EmailAddress = $_.PrimarySMTPAddress
# RecipientType= $_.RecipientType
# }
# }
#} | Export-CSV “${Env:UserProfile}\Desktop\group-export.csv" -NoTypeInformation -Encoding UTF8