A PowerShell script that leverages Ollama AI to generate and execute commands based on user questions.
This script interacts with the Ollama AI platform to perform tasks in a Windows environment using PowerShell. It allows users to generate detailed command sequences or single commands by providing a natural language question. The script also supports automatic execution of generated commands.
- AI-Powered Command Generation: Uses Ollama AI models to generate PowerShell commands based on user questions.
- Error Handling: Checks for Ollama installation and validates inputs.
- Multiple Models Support: Supports different AI models available in Ollama.
- User Interaction: Provides options to execute commands automatically or receive explanations.
- Ollama Installed: Ensure Ollama is installed on your system. If not, download it from ollama.ai.
- Powershell: Windows PowerShell must be installed and configured on your system.
- Clone this repository or download the
how.ps1script. - Place the script in a directory of your choice.
- Open PowerShell as an administrator if necessary, depending on the tasks you plan to perform.
Run the script with a question:
.\how.ps1 "What is the current date?"-y: Automatically execute the generated command without user confirmation.-m <model_name>: Specify an Ollama model to use for generating commands. For example:.\how.ps1 -m llama3.2:latest "How can I create a backup of my files?"
- Use e at the end of your question to explain the command in details.
-
Generate and execute a command: (Use with caution)
.\how.ps1 "List all running processes" -y
-
Generate a command and receive an explanation:
.\how.ps1 "How can I create a system backup?"
Contributions are welcome! If you encounter issues or have suggestions, please open an issue on the GitHub repository or submit a pull request.
Go for it :)
This README provides clear instructions for users and contributors, ensuring that anyone who downloads the script understands how to use it effectively.