PSLansweeper
PSLansweeper copied to clipboard
PowerShell Module to interact with Lansweeper Database
PSLansweeper - PowerShell Module
PSLansweeper
is small module (about 80 lines of code) that interacts with Lansweeper SQL Database. It does need direct access to SQL.
Changelog
- 0.0.1 - 2019.07.13
- First Release (draft)
- 0.0.3 - 2019.07.14 - Blog post with description: https://evotec.xyz/using-lansweeper-with-powershell-to-your-advantage/
- First Public release
Usage
Import-Module PSLansweeper
$Test = Get-LansweeperReport -SqlInstance "LANSWEEPER.AD.EVOTEC.XYZ" -Report WindowsAutomaticUpdateSettingsAudit
$Test | Format-Table *
$Test = Get-LansweeperReport -SqlInstance "LANSWEEPER.AD.EVOTEC.XYZ" -Report WindowsAutomaticUpdateSettingsAudit,MicrosoftPatchTuesdayAuditJuly2019
$Test.WindowsAutomaticUpdateSettingsAudit | Format-Table -AutoSize
$Test.MicrosoftPatchTuesdayAuditJuly2019 | Format-Table -AutoSize
Example 1
Get-LansweeperReport -SqlInstance "LANSWEEPER.AD.EVOTEC.XYZ" -Report SoftwareLicenseKeyOverview | Format-Table -Autosize
Get-LansweeperReport -SqlInstance "LANSWEEPER.AD.EVOTEC.XYZ" -Report InstalledWindowsUpdates | Format-Table -Autosize
Example 2
Get-LansweeperReport -SqlInstance "LANSWEEPER.AD.EVOTEC.XYZ" -Report AdobeJulySecurityUpdateVulernabilityAudit
Example 3
Get-LansweeperReport -SqlInstance "LANSWEEPER.AD.EVOTEC.XYZ" -Report ComputerProcessorInformation,AllServerTypes
To install
Following way uses PowerShellGallery to install module. When I publish modules to PSGallery those modules are optimized for speed (minified)
Install-Module -Name PSLansweeper -AllowClobber -Force
Force and AllowClobber aren't really nessecary but they do skip errors in case some appear (like conflict with other modules).
And to update
Update-Module -Name PSLansweeper
That's it. Whenever there's new version you simply run the command and you can enjoy it. Remember, that you may need to close, reopen PowerShell session if you have already used module before updating it.
The important thing is if something works for you on production, keep using it till you test the new version on a test computer. I do changes that may not be big, but big enough that auto-update will break your code. For example, small rename to a parameter and your code stops working! Be responsible!
Credits
- Marcus Dean created LansweeperPS PowerShell module which does similar thing. He's also inspiration for this little project as per this Reddit thread.
3rd Party Notices
- [x] All SQL code available in Reports folder is copied from Lansweeper Report or Lansweeper Community Forum. This means that all SQL content is work of someone else. They made those reports. I just made them easily available in this PowerShell Module.