AntoineGS / TeamsStatusV2

Monitoring your Microsoft Teams status with PowerShell
39 stars 6 forks source link

install.ps1 gives error at first #2

Closed mhoogenbosch closed 2 years ago

mhoogenbosch commented 2 years ago

See error message:

PS C:\scripts> .\Install.ps1
.\Install.ps1 : File C:\scripts\Install.ps1 cannot be loaded. The file C:\scripts\Install.ps1 is not digitally signed.
You cannot run this script on the current system. For more information about running scripts and setting execution poli
cy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\Install.ps1
+ ~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

So I first did the following:

PS C:\scripts> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
PS C:\scripts> Unblock-File .\Settings.ps1
PS C:\scripts> Unblock-File .\Get-TeamsStatus.ps1
PS C:\scripts> Unblock-File .\Install.ps1
PS C:\scripts> Unblock-File .\Uninstall.ps1
PS C:\scripts> Unblock-File .\TSFunctions.ps1

And if you already manually have removed the service, it gives an error too:

PS C:\scripts> .\Install.ps1
Stop-Service : Cannot find any service with service name 'Microsoft Teams Status Monitor'.
At C:\scripts\TSFunctions.ps1:2 char:5
+     Stop-Service -Name "Microsoft Teams Status Monitor"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft Teams Status Monitor:String) [Stop-Service], ServiceCommandEx
   ception
    + FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.StopServiceCommand

Can't open service!
OpenService(): De opgegeven service is geen geïnstalleerde service.

After doing it for the second time, with the service installed it works great!

AntoineGS commented 2 years ago

Ah that makes sense I'll add the step to set the rights on the install script before running it!

AntoineGS commented 2 years ago

closed by ae6a583fb6a19ca987971091c6bad8c0619d1b5b