UnifyWeaver

Book 12: PowerShell Target

Windows Automation and .NET Scripting

Part of the UnifyWeaver Education Series

This book covers compiling Prolog predicates to PowerShell scripts. PowerShell’s deep Windows integration and .NET access make this target ideal for Windows automation, system administration, and enterprise environments.

Prerequisites

Required:

Recommended:

Technical:

Implementation Status

This table shows the current implementation status of features described in each chapter.

Chapter Feature Status Notes
Ch 1 Basic compilation Implemented compile_to_powershell/3 works
Ch 1 Module loading Implemented use_module(unifyweaver(core/powershell_compiler))
Ch 2 Facts to arrays Implemented Facts compile to PSCustomObject arrays
Ch 2 Rules to joins Partial Rules generate join code, but don’t auto-include dependent facts
Ch 3 CmdletBinding Not yet Advanced function attributes not generated
Ch 3 Parameter validation Not yet [ValidateSet()], [Mandatory] not generated
Ch 3 Begin/Process/End Partial Only in .NET mode via dotnet_source
Ch 4 dotnet_source Implemented Inline C# compilation works
Ch 4 DLL caching Implemented pre_compile(true) generates caching
Ch 4 NuGet references Implemented references(['LiteDB']) works
Ch 5 Windows automation Design only Examples show patterns, not auto-generated

Legend: Implemented = tested and working, Partial = works with limitations, Not yet = documented but not implemented, Design only = conceptual/aspirational

Learning Path

1. Introduction - Implemented

2. Facts and Rules - Mostly Implemented

3. Cmdlet Generation - Design Document

4. .NET Integration - Fully Implemented

5. Windows Automation - Design Document

Part 3: Advanced Topics (Planned)

Chapter 6: In-Process Hosting (coming soon)

Chapter 7: Active Directory (coming soon)

Chapter 8: Enterprise Patterns (coming soon)

Quick Example

% Define a Windows service checker
service_running(Name) :-
    get_service(Name, Status),
    Status == 'Running'.

% Compile to PowerShell
?- compile_to_powershell(service_running/1, [], Code).

% Generated PowerShell:
% function Test-ServiceRunning {
%     param([string]$Name)
%     $service = Get-Service -Name $Name -ErrorAction SilentlyContinue
%     return $service.Status -eq 'Running'
% }

What’s Next?

After completing Book 12, continue to:

License

This educational content is licensed under CC BY 4.0. Code examples are dual-licensed under MIT OR Apache-2.0.