16 lines
		
	
	
	
		
			636 B
		
	
	
	
		
			PowerShell
		
	
	
	
	
	
		
		
			
		
	
	
			16 lines
		
	
	
	
		
			636 B
		
	
	
	
		
			PowerShell
		
	
	
	
	
	
|  | $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');" | ||
|  | } |