Add scripts
This commit is contained in:
parent
422934aef7
commit
350807c951
30 changed files with 574 additions and 0 deletions
16
Scripts/Get-ServiceToSQLite.ps1
Normal file
16
Scripts/Get-ServiceToSQLite.ps1
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
$path = "$home\Documents\Get-Service.db"
|
||||
$Module = Get-Module MySQLite
|
||||
if ($Module -eq $null) {
|
||||
Install-Module MySQLite -Repository PSGallery -Scope CurrentUser
|
||||
}
|
||||
Import-Module MySQLite
|
||||
New-MySQLiteDB -Path $path
|
||||
Invoke-MySQLiteQuery -Path $path -Query "CREATE TABLE Service (Name TEXT NOT NULL, DisplayName TEXT NOT NULL, Status TEXT NOT NULL);"
|
||||
|
||||
$Service = Get-Service | select Name,DisplayName,Status
|
||||
foreach ($S in $Service) {
|
||||
$Name = $S.Name
|
||||
$DName = $S.DisplayName
|
||||
$Status = $S.Status
|
||||
Invoke-MySQLiteQuery -Path $path -Query "INSERT INTO Service (Name, DisplayName, Status) VALUES ('$Name', '$DName', '$Status');"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue