-
Notifications
You must be signed in to change notification settings - Fork 0
Usage
This page describes how to run, schedule and troubleshoot SPSWeather.
| Parameter | Type | Description |
|---|---|---|
-ConfigFile |
string |
Path to the environment configuration .psd1 file. Mandatory. |
-EnableSmtp |
switch |
Send the HTML report by email over SMTP. |
-Install |
switch |
Register SPSWeather as a scheduled task and store the service credential in secrets.psd1. |
-InstallAccount |
PSCredential |
The service account that runs the scheduled task (required with -Install). |
-Uninstall |
switch |
Remove the SPSWeather scheduled task and the stored secret. |
.\SPSWeather.ps1 -ConfigFile 'Config\contoso-PROD.psd1'.\SPSWeather.ps1 -ConfigFile 'Config\contoso-PROD.psd1' -EnableSmtpRun this as the service account so the stored credential is decryptable at run time:
.\SPSWeather.ps1 -ConfigFile 'Config\contoso-PROD.psd1' -Install -InstallAccount (Get-Credential).\SPSWeather.ps1 -ConfigFile 'Config\contoso-PROD.psd1' -UninstallEach run writes, next to SPSWeather.ps1:
-
Results\<app>-<env>-<date>.html— the HTML report (also used as the email body). -
Results\<app>-<env>-<date>.json— a JSON snapshot of the collected data. -
Logs\<app>-<env>-<date>.log— the PowerShell transcript. Logs older than the retention window are pruned automatically.
The email subject is prefixed with the overall status, e.g. [ALERT]contoso_PROD - Meteo SharePoint <date>. The priority is raised to High when an alert is detected. See Health Checks for the list of checks and how an ALERT is raised.
-Install registers a scheduled task named SPSWeather-<app>-<env> that runs the script with -EnableSMTP as the service account. A typical setup:
| Field | Value |
|---|---|
| Run as | Service account (member of local Administrators on the run server) |
| Trigger | Daily, e.g. every morning at 06:00 |
| Action | powershell.exe -NoProfile -ExecutionPolicy Bypass -File "D:\SCRIPT\SPSWeather\SPSWeather.ps1" -ConfigFile "D:\SCRIPT\SPSWeather\Config\contoso-PROD.psd1" -EnableSMTP |
| Run whether user is logged on or not | Yes |
| Run with highest privileges | Yes |
Important
The scheduled task action must run via powershell.exe (Windows PowerShell 5.1), not pwsh.exe: SPSWeather relies on the Microsoft.SharePoint.PowerShell snap-in and CredSSP remoting.
SPSWeather writes lifecycle entries to a dedicated SPSWeather Windows Event Log, created on first use (the run must be elevated):
Event Viewer → Applications and Services Logs → SPSWeather
| Event ID | Type | Meaning |
|---|---|---|
| 1000 | Information | A health-check run started. |
| 1001 | Information | The run completed with no alert. |
| 2000 | Warning | The run completed with ALERT conditions. |
| 3000 | Error | The report email could not be sent. |
Each event header records the SPSWeather version, the user and the computer name:
SPSWeather Version: 2.0.0
User: CONTOSO\svc_spsweather
ComputerName: SPS-APP-01
Recommended Event Viewer filters:
-
EntryType = Warning or Errorto surface runs that need attention (alerts and email failures). -
Event ID = 2000to focus on farms that reported an alert. - Text contains
Version: 2.0.0to spot servers running an outdated build.
Query the log from PowerShell with:
Get-WinEvent -LogName SPSWeather -MaxEvents 20Failed to import function file '...\SPSWeather.Common\...'
- Confirm the
Modules\SPSWeather.Common\folder lives next toSPSWeather.ps1. - Confirm the running account has read access to that folder.
- Run
Test-ModuleManifest .\Modules\SPSWeather.Common\SPSWeather.Common.psd1to confirm the manifest is valid.
Missing <path>
The -ConfigFile path does not exist. Pass the full path to your .psd1 config (copied from Config\CONTOSO-PROD.example.psd1).
Credential 'PROD-ADM' was not found in Config\secrets.psd1. Run SPSWeather.ps1 -Install
as the service account, or populate secrets.psd1 manually.
secrets.psd1 has no entry for the CredentialKey declared in your config. Run -Install as the service account, or add the entry by hand (see Configuration).
Failed to decode SecureString for secret 'PROD-ADM'. The value must be the output of
ConvertFrom-SecureString on the current user account and machine.
The value in secrets.psd1 was generated by a different account or on a different server. DPAPI binds the encrypted value to the account + machine that created it. Regenerate it under the account that runs the scheduled task, on this server.
You do not have Administrator rights to run this script!
SPSWeather needs elevation to create its Event Log source on first use and to call SharePoint cmdlets. Re-run the console (or the scheduled task) as Administrator.
Remoting into the farm servers uses CredSSP. Confirm CredSSP is configured on both the client and the target servers (see Getting Started → Configure CredSSP) and that the service account can open a New-PSSession to each farm server.
See the Health Checks reference, or the Release Process for maintainers.
Navigation
Project