-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7dc780
commit 2289864
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
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,35 @@ | ||
# Check for admin privilege first before proceeding... | ||
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(` | ||
[Security.Principal.WindowsBuiltInRole]::Administrator)) { | ||
Write-Host "Ensure to tun this PowerShell module in Administrator mode!" -ForegroundColor "Red" | ||
return | ||
} | ||
|
||
Write-Host "Stopping WSSDAgent service" | ||
Stop-Service wssdagent | ||
Remove-Item -Force -Path "HKLM:SOFTWARE\Microsoft\WssdAgent\v0.10.8-alpha.10\CertificateInternal" | ||
Remove-Item -Force -Path "HKLM:SOFTWARE\Microsoft\WssdAgent\v0.10.8-alpha.10\IdentityInternal" | ||
|
||
Write-Host "Restarting WSSDAgent service" | ||
Start-Service wssdagent | ||
Start-Sleep 10 | ||
|
||
Remove-Item -Recurse -Force -Path "$env:UserProfile\.wssd\nodectl" | ||
|
||
& "$env:ProgramFiles\Azure IoT Edge\nodectl.exe" security login --loginpath "$env:Programdata\wssdagent\nodelogin.yaml" --identity | ||
Start-Sleep 15 | ||
Copy-Item -Path "$env:UserProfile\.wssd\nodectl\cloudconfig" -Destination "$env:Programdata\azure iot edge\protected\.wssd\cloudconfig" -Force | ||
|
||
Remove-Item -Recurse -Force -Path "$env:UserProfile\.wssd\nodectl" | ||
|
||
try | ||
{ | ||
Invoke-EflowVmCommand "ls -la" | ||
Write-Host "Connection to EFLOW VM successful." | ||
} | ||
catch [Exception] | ||
{ | ||
Write-Host "Error caught while invoking VM command" | ||
$e = $_.Exception | ||
Write-Host $e.Message.ToString() | ||
} |