-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the initial commit of the Azure Migrate Setup Util
- Loading branch information
Showing
18 changed files
with
17,348 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Synchronized="False" SyncFilter="*.ps1;*.psm1;*.psd1;*.ps1xml;*.psf;*.pss;*.xml;*.help.txt"> | ||
<Version>2.1</Version> | ||
<FileID>aaddbbfb-1591-4905-8d60-3c87a174a6ed</FileID> | ||
<ProjectType>0</ProjectType> | ||
<Folders /> | ||
<Files> | ||
<File Build="0">Startup.pss</File> | ||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Global_ps1">Globals.ps1</File> | ||
<File Build="0" ReferenceFunction="Show-MainForm_psf">MainForm.psf</File> | ||
<File Build="2" Shared="True" ReferenceFunction="Invoke-Add-NetAddress_ps1">Add-NetAddress.ps1</File> | ||
<File Build="2" Shared="True" ReferenceFunction="Invoke-Set-Proxy_ps1">Set-Proxy.ps1</File> | ||
<File Build="2" Shared="True" ReferenceFunction="Invoke-Import-Cert_ps1">Import-Cert.ps1</File> | ||
</Files> | ||
</Project> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<ProjectState> | ||
<Version>1.0</Version> | ||
<FileID>aaddbbfb-1591-4905-8d60-3c87a174a6ed</FileID> | ||
<OpenFolders /> | ||
<OpenFiles> | ||
<File>Globals.ps1</File> | ||
<File>Add-NetAddress.ps1</File> | ||
<File>Set-Proxy.ps1</File> | ||
<File>Import-Cert.ps1</File> | ||
<File>MainForm.psf</File> | ||
<File>Startup.pss</File> | ||
</OpenFiles> | ||
</ProjectState> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<# | ||
.NOTES | ||
=========================================================================== | ||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2019 v5.6.170 | ||
Created on: 12/11/2019 11:24 AM | ||
Created by: 212670239 | ||
Organization: | ||
Filename: Add-NetAddress.ps1 | ||
=========================================================================== | ||
.DESCRIPTION | ||
A description of the file. | ||
#> | ||
|
||
function Convert-Subnetmask | ||
{ | ||
param | ||
( | ||
[parameter(Mandatory = $true)] | ||
[string] | ||
$subnetmask | ||
) | ||
try | ||
{ | ||
$netMaskIP = [IPAddress]$subnetmask | ||
|
||
$binaryString = [String]::Empty | ||
$netMaskIP.GetAddressBytes() | Foreach { | ||
# combine each | ||
$binaryString += [Convert]::ToString($_, 2) | ||
} | ||
|
||
return $binaryString.TrimEnd('0').Length | ||
} | ||
catch | ||
{ | ||
return $_ | ||
} | ||
} | ||
|
||
function Convert-Prefix | ||
{ | ||
param | ||
( | ||
[parameter(Mandatory = $true)] | ||
[string]$prefixLength | ||
) | ||
try | ||
{ | ||
$bitString = ('1' * $prefixLength).PadRight(32, '0') | ||
|
||
$ipString = [String]::Empty | ||
|
||
# make 1 string combining a string for each byte and convert to int | ||
for ($i = 0; $i -lt 32; $i += 8) | ||
{ | ||
$byteString = $bitString.Substring($i, 8) | ||
$ipString += "$([Convert]::ToInt32($byteString, 2))." | ||
} | ||
|
||
return $ipString.TrimEnd('.') | ||
} | ||
catch | ||
{ | ||
return $_ | ||
} | ||
} | ||
|
||
function Set-IPAddress | ||
{ | ||
param ( | ||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)] | ||
[string]$Nic, | ||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)] | ||
[string]$Ipadd, | ||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)] | ||
[string]$Gw, | ||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)] | ||
[string]$Sn | ||
) | ||
|
||
$rslt = New-NetIPAddress -InterfaceAlias $Nic -IPAddress $Ipadd -DefaultGateway $Gw -PrefixLength $(Convert-Subnetmask $Sn) -ErrorVariable $rslterr | ||
if (!$rslterr) | ||
{ | ||
return $rslt | ||
} | ||
else | ||
{ | ||
return $rslterr | ||
} | ||
|
||
} | ||
|
||
function Set-DNS | ||
{ | ||
param ( | ||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)] | ||
[string]$Nic, | ||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)] | ||
[string[]]$DnsAdds | ||
) | ||
|
||
$rslt = Set-DnsClientServerAddress -InterfaceAlias $Nic -ServerAddresses $DnsAdds -ErrorVariable $rslterr | ||
if (!$rslterr) | ||
{ | ||
return $rslt | ||
} | ||
else | ||
{ | ||
return $rslterr | ||
} | ||
|
||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<# | ||
.NOTES | ||
=========================================================================== | ||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2019 v5.6.170 | ||
Created on: 12/11/2019 11:24 AM | ||
Created by: 212670239 | ||
Organization: | ||
Filename: Add-NetAddress.ps1 | ||
=========================================================================== | ||
.DESCRIPTION | ||
A description of the file. | ||
#> | ||
|
||
function Convert-Subnetmask | ||
{ | ||
param | ||
( | ||
[parameter(Mandatory = $true)] | ||
[string] | ||
$subnetmask | ||
) | ||
try | ||
{ | ||
$netMaskIP = [IPAddress]$subnetmask | ||
|
||
$binaryString = [String]::Empty | ||
$netMaskIP.GetAddressBytes() | Foreach { | ||
# combine each | ||
$binaryString += [Convert]::ToString($_, 2) | ||
} | ||
|
||
return $binaryString.TrimEnd('0').Length | ||
} | ||
catch | ||
{ | ||
return $_ | ||
} | ||
} | ||
|
||
function Convert-Prefix | ||
{ | ||
param | ||
( | ||
[parameter(Mandatory = $true)] | ||
[string]$prefixLength | ||
) | ||
try | ||
{ | ||
$bitString = ('1' * $prefixLength).PadRight(32, '0') | ||
|
||
$ipString = [String]::Empty | ||
|
||
# make 1 string combining a string for each byte and convert to int | ||
for ($i = 0; $i -lt 32; $i += 8) | ||
{ | ||
$byteString = $bitString.Substring($i, 8) | ||
$ipString += "$([Convert]::ToInt32($byteString, 2))." | ||
} | ||
|
||
return $ipString.TrimEnd('.') | ||
} | ||
catch | ||
{ | ||
return $_ | ||
} | ||
} | ||
|
||
function Set-IPAddress | ||
{ | ||
param ( | ||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)] | ||
[string]$Nic, | ||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)] | ||
[string]$Ipadd, | ||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)] | ||
[string]$Gw, | ||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)] | ||
[string]$Sn | ||
) | ||
|
||
$rslt = New-NetIPAddress -InterfaceAlias $Nic -IPAddress $Ipadd -DefaultGateway $Gw -PrefixLength $(Convert-Subnetmask $Sn) -ErrorVariable $rslterr | ||
if (!$rslterr) | ||
{ | ||
return $rslt | ||
} | ||
else | ||
{ | ||
return $rslterr | ||
} | ||
|
||
} | ||
|
||
function Set-DNS | ||
{ | ||
param ( | ||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)] | ||
[string]$Nic, | ||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)] | ||
[string]$DnsAdd | ||
) | ||
[string[]] $DnsAdds = $DnsAdd.Split('|', ',',';') | ||
$rslt = Set-DnsClientServerAddress -InterfaceAlias $Nic -ServerAddresses $DnsAdds -ErrorVariable $rslterr | ||
if (!$rslterr) | ||
{ | ||
return $rslt | ||
} | ||
else | ||
{ | ||
return $rslterr | ||
} | ||
|
||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#-------------------------------------------- | ||
# Declare Global Variables and Functions here | ||
#-------------------------------------------- | ||
|
||
|
||
#Sample function that provides the location of the script | ||
function Get-ScriptDirectory | ||
{ | ||
<# | ||
.SYNOPSIS | ||
Get-ScriptDirectory returns the proper location of the script. | ||
.OUTPUTS | ||
System.String | ||
.NOTES | ||
Returns the correct path within a packaged executable. | ||
#> | ||
[OutputType([string])] | ||
param () | ||
if ($null -ne $hostinvocation) | ||
{ | ||
Split-Path $hostinvocation.MyCommand.path | ||
} | ||
else | ||
{ | ||
Split-Path $script:MyInvocation.MyCommand.Path | ||
} | ||
} | ||
|
||
#Sample variable that provides the location of the script | ||
[string]$ScriptDirectory = Get-ScriptDirectory | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<# | ||
.NOTES | ||
=========================================================================== | ||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2019 v5.6.170 | ||
Created on: 1/15/2020 10:26 AM | ||
Created by: 212670239 | ||
Organization: | ||
Filename: Import-Cert.ps1 | ||
=========================================================================== | ||
.DESCRIPTION | ||
A description of the file. | ||
#> | ||
|
||
function Import-Cert | ||
{ | ||
param | ||
( | ||
[parameter(Mandatory = $true)] | ||
[string]$certpath, | ||
[parameter(Mandatory = $true)] | ||
[string]$certdst, | ||
[parameter(Mandatory = $true)] | ||
[object[]]$certstores | ||
) | ||
$rslt | ||
try | ||
{ | ||
switch ($certdst) | ||
{ | ||
'localmachine' { | ||
foreach ($ct in $certstores) | ||
{ | ||
switch ($ct) | ||
{ | ||
'Personal' { | ||
Import-Certificate -FilePath $certpath -CertStoreLocation cert:\LocalMachine\My | ||
$rslt += "$certpath imported in to cert:\LocalMachine\My `r`n" | ||
break; | ||
} | ||
'Root' { | ||
Import-Certificate -FilePath $certpath -CertStoreLocation cert:\LocalMachine\Root | ||
$rslt += "$certpath imported in to cert:\LocalMachine\Root `r`n" | ||
break; | ||
} | ||
'Intermediate' { | ||
Import-Certificate -FilePath $certpath -CertStoreLocation cert:\LocalMachine\CA | ||
$rslt += "$certpath imported in to cert:\LocalMachine\CA `r`n" | ||
break; | ||
} | ||
} | ||
} | ||
|
||
break; | ||
} | ||
'currentuser' { | ||
foreach ($ct in $certstores) | ||
{ | ||
switch ($ct) | ||
{ | ||
'Personal' { | ||
Import-Certificate -FilePath $certpath -CertStoreLocation cert:\CurrentUser\My | ||
$rslt += "$certpath imported in to cert:\CurrentUser\My `r`n" | ||
break; | ||
} | ||
'Root' { | ||
Import-Certificate -FilePath $certpath -CertStoreLocation cert:\CurrentUser\Root | ||
$rslt += "$certpath imported in to cert:\CurrentUser\Root `r`n" | ||
break; | ||
} | ||
'Intermediate' { | ||
Import-Certificate -FilePath $certpath -CertStoreLocation cert:\CurrentUser\CA | ||
$rslt += "$certpath imported in to cert:\CurrentUser\CA `r`n" | ||
break; | ||
} | ||
} | ||
} | ||
break; | ||
} | ||
default { | ||
$rslt = 'No path Choosen' | ||
break; | ||
} | ||
} | ||
return $rslt | ||
} | ||
catch | ||
{ | ||
return $_ | ||
} | ||
|
||
} | ||
|
Oops, something went wrong.