Skip to content

Commit

Permalink
moved add-type to Unzip function
Browse files Browse the repository at this point in the history
  • Loading branch information
robledosm committed Aug 18, 2017
1 parent 29a6084 commit 787c36b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions update-mvpsHosts.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
param([switch]$Elevated)
Add-Type -AssemblyName System.IO.Compression.FileSystem
function checkAdmin {
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}

if ((checkAdmin) -eq $false) {
if ($elevated)
{
Expand All @@ -17,10 +15,9 @@ if ((checkAdmin) -eq $false) {
}
function Unzip {
param([string]$zipfile, [string]$outpath)

Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}

function BackupLocalHost {
param([string]$hostFilePath)
Copy-Item $hostFilePath "$hostFilePath.bak_$(Get-Date -format FileDate)"
Expand Down

0 comments on commit 787c36b

Please sign in to comment.