Skip to content

Commit

Permalink
Added CLI parameters and help page
Browse files Browse the repository at this point in the history
  • Loading branch information
herrwinfried committed May 30, 2024
1 parent 5809133 commit 4cc6214
Show file tree
Hide file tree
Showing 7 changed files with 312 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.xml
*.exe
[Oo][Ff][Ff][Ii][Cc][Ee]
[Oo][Ff][Ff][Ii][Cc][Ee].[Oo][Ll][Dd]
[Oo][Ff][Ff][Ii][Cc][Ee].[Oo][Ll][Dd]
.vscode
85 changes: 85 additions & 0 deletions Help/BENIOKU.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Office Dağıtım Aracı PowerShell Script</title>
<style>
body {
font-family: Arial, sans-serif;
}
pre {
background-color: #f4f4f4;
padding: 10px;
border: 1px solid #ddd;
overflow-x: auto;
}
code {
background-color: #f4f4f4;
padding: 2px 4px;
border-radius: 4px;
}
.center {
text-align: center;
}
</style>
</head>
<body>
<div class="center">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Microsoft_365_%282022%29.svg/1862px-Microsoft_365_%282022%29.svg.png" width="150" height="150">
<img src="https://raw.githubusercontent.com/PowerShell/PowerShell/master/assets/ps_black_64.svg?sanitize=true" width="150" height="150">
<p><b>Office Deployment Tool Kullanımını Kolaylaştırmak İçin PowerShell Script</b></p>
</div>
<div class="center">
<img src="../assets/image/odt-script.png" height="400" alt="ODT Script">
</div>
<h1>Office Dağıtım Aracı PowerShell Script</h1>
<p>Bu PowerShell script, Office Deployment Tool kullanımını kolaylaştırmak için basit ve etkileşimli bir arayüz sağlar.</p>

<h2>Kullanım</h2>

<h3>Seçenek 1: Yükleyici ile Çalıştırma</h3>
<p><code>installer.bat</code> dosyasına çift tıklayın.</p>

<h4>VEYA</h4>
<p>Aşağıdaki PowerShell komutunu çalıştırın:</p>
<pre><code>start powershell.exe -ExecutionPolicy Bypass -File .\installer.ps1
</code></pre>

<h3>Seçenek 2: Komut Satırı Arayüzünde (CLI) Çalıştırma</h3>
<pre><code>Kullanım:
.\installer.ps1 [-h] [-c &lt;ConfigFile&gt;] [-i] [-d]

Parametreler:
-h, -?, -Help
Bu yardım mesajını görüntüler.

-c, -ConfigFile &lt;ConfigFile&gt;
Kullanılacak yapılandırma dosyasını belirtir.

-i, -Install
Kurulum sürecini başlatır.

-d, -Download
İndirme sürecini başlatır.
</code></pre>

<h4>Örnek Komut</h4>
<pre><code>powershell.exe -ExecutionPolicy Bypass -File .\installer.ps1 -i -d
</code></pre>

<h2>Faydalı Bağlantılar</h2>
<ul>
<li><a href="https://config.office.com/">config.office.com</a> (<a href="https://learn.microsoft.com/en-us/deployoffice/office-deployment-tool-configuration-options">Dokümantasyon</a>)
<ul>
<li>Office dağıtımı için yapılandırma dosyalarını oluşturmanın kolay bir yolu.</li>
</ul>
</li>
<li><a href="https://aka.ms/SaRA-OfficeUninstallFromPC">SetupProd_OffScrub.exe</a> (<a href="https://support.microsoft.com/en-us/office/uninstall-office-automatically-9ad57b43-fa12-859a-9cf0-b694637b3b05">Dokümantasyon</a>)
<ul>
<li>Office kurulumu bozulduğunda yardımcı olan bu uygulama ile Office'i kaldırabilir ve yeniden yükleyebilirsiniz. Özellikle kaldırma işlemleri için kullanışlıdır.</li>
</ul>
</li>
</ul>
</body>
</html>
85 changes: 85 additions & 0 deletions Help/README.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Office Deployment Tool PowerShell Script</title>
<style>
body {
font-family: Arial, sans-serif;
}
pre {
background-color: #f4f4f4;
padding: 10px;
border: 1px solid #ddd;
overflow-x: auto;
}
code {
background-color: #f4f4f4;
padding: 2px 4px;
border-radius: 4px;
}
.center {
text-align: center;
}
</style>
</head>
<body>
<div class="center">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Microsoft_365_%282022%29.svg/1862px-Microsoft_365_%282022%29.svg.png" width="150" height="150">
<img src="https://raw.githubusercontent.com/PowerShell/PowerShell/master/assets/ps_black_64.svg?sanitize=true" width="150" height="150">
<p><b>Powershell Script to Simplify Office Deployment Tool Usage</b></p>
</div>
<div class="center" >
<img src="../assets/image/odt-script.png" height="400" alt="ODT Script">
</div>
<h1>Office Deployment Tool PowerShell Script</h1>
<p>This PowerShell script is designed to make the Office Deployment Tool easier to use by providing a simple and interactive interface.</p>

<h2>Usage</h2>

<h3>Option 1: Run with Installer</h3>
<p>Double-click the <code>installer.bat</code> file.</p>

<h4>OR</h4>
<p>Run the following PowerShell command:</p>
<pre><code>start powershell.exe -ExecutionPolicy Bypass -File .\installer.ps1
</code></pre>

<h3>Option 2: Run in Command Line Interface (CLI)</h3>
<pre><code>Usage:
.\installer.ps1 [-h] [-c &lt;ConfigFile&gt;] [-i] [-d]

Parameters:
-h, -?, -Help
Displays this help message.

-c, -ConfigFile &lt;ConfigFile&gt;
Specifies the configuration file to be used.

-i, -Install
Triggers the installation process.

-d, -Download
Starts the download process.
</code></pre>

<h4>Example Command</h4>
<pre><code>powershell.exe -ExecutionPolicy Bypass -File .\installer.ps1 -i -d
</code></pre>

<h2>Useful Links</h2>
<ul>
<li><a href="https://config.office.com/">config.office.com</a> (<a href="https://learn.microsoft.com/en-us/deployoffice/office-deployment-tool-configuration-options">Documentation</a>)
<ul>
<li>An easy way to create configuration files for Office deployment.</li>
</ul>
</li>
<li><a href="https://aka.ms/SaRA-OfficeUninstallFromPC">SetupProd_OffScrub.exe</a> (<a href="https://support.microsoft.com/en-us/office/uninstall-office-automatically-9ad57b43-fa12-859a-9cf0-b694637b3b05">Documentation</a>)
<ul>
<li>This application helps when the Office installation is corrupted. It can be used to uninstall and reinstall Office, and is particularly useful for uninstallation purposes.</li>
</ul>
</li>
</ul>
</body>
</html>
55 changes: 48 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,55 @@
<div align="center">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Microsoft_365_%282022%29.svg/1862px-Microsoft_365_%282022%29.svg.png" width="150" height="150">
<img src="https://raw.githubusercontent.com/PowerShell/PowerShell/master/assets/ps_black_64.svg?sanitize=true" width="150" height="150">
<p> <b>Powershell script designed to make the office deployment tool tool easier to use </b></p>
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Microsoft_365_%282022%29.svg/1862px-Microsoft_365_%282022%29.svg.png" width="150" height="150">
<img src="https://raw.githubusercontent.com/PowerShell/PowerShell/master/assets/ps_black_64.svg?sanitize=true" width="150" height="150">
<p><b>Powershell Script to Simplify Office Deployment Tool Usage</b></p>
</div>

<img src="./assets/image/odt-script.png">

# Usage
# Office Deployment Tool PowerShell Script

This PowerShell script is designed to make the Office Deployment Tool easier to use by providing a simple and interactive interface.

## Usage

### Option 1: Run with Installer

Double-click the `installer.bat` file.
### OR
```pwsh

#### OR

Run the following PowerShell command:

```bat
start powershell.exe -ExecutionPolicy Bypass -File .\installer.ps1
```
```
### Option 2: Run in Command Line Interface (CLI)
```powershell
Usage:
.\installer.ps1 [-h] [-c <ConfigFile>] [-i] [-d]
Parameters:
-h, -?, -Help
Displays this help message.
-c, -ConfigFile <ConfigFile>
Specifies the configuration file to be used.
-i, -Install
Triggers the installation process.
-d, -Download
Starts the download process.
```
#### Example Command
```powershell
powershell.exe -ExecutionPolicy Bypass -File .\installer.ps1 -i -d
```

## Useful Links

- [config.office.com](https://config.office.com/) ([Documentation](https://learn.microsoft.com/en-us/deployoffice/office-deployment-tool-configuration-options))
- An easy way to create configuration files for Office deployment.
- [SetupProd_OffScrub.exe](https://aka.ms/SaRA-OfficeUninstallFromPC) ([Documentation](https://support.microsoft.com/en-us/office/uninstall-office-automatically-9ad57b43-fa12-859a-9cf0-b694637b3b05))
- This application helps when the Office installation is corrupted. It can be used to uninstall and reinstall Office, and is particularly useful for uninstallation purposes.
67 changes: 65 additions & 2 deletions installer.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
param(
[Alias("h", "?")]
[switch]$Help,
[Alias("c")]
[string]$ConfigFile,
[Alias("i")]
[switch]$Install,
[Alias("d")]
[switch]$Download
)
$GetScriptDir = $PSScriptRoot
[string]$GetScriptName = [System.IO.Path]::GetFileNameWithoutExtension($MyInvocation.MyCommand.Name)

Expand Down Expand Up @@ -154,11 +164,15 @@ function Set-ConfigPath {
}
}

function Show-Menu {
function Show-Welcome {
Write-Host -ForegroundColor Magenta "Github: https://github.com/herrwinfried/odt-script"
Write-Host -ForegroundColor Green "$($Language.ShowMenuConfigPath -f $ConfigPath)"
Write-Host -ForegroundColor Cyan "$($Language.ShowMenuOfficePath -f $GetOfficePath)"
Write-Host ""
}

function Show-Menu {
Show-Welcome
Write-Host -ForegroundColor DarkYellow "$($Language.ShowMenuSelection)`n"
Write-Host -ForegroundColor Red "[0] $($Language.ShowMenuZero)"
Write-Host -ForegroundColor DarkCyan "[1] $($Language.ShowMenuOne)"
Expand Down Expand Up @@ -201,4 +215,53 @@ function Show-Menu {
}
}

Show-Menu
if ($ConfigFile) {
if (Test-Path $ConfigFile) {
[string]$Global:ConfigPath = $ConfigFile
Write-Host -ForegroundColor Green "$($Language.SetConfigSuccessPath -f $ConfigFile)"
Write-Warning "$($Language.SetConfigSuccessWarn)"
Write-host
} else {
Write-Host -ForegroundColor Red "$($Language.SetConfigFailedPath -f $ConfigFile)"
Write-host
}
}
if ($Help) {
$helpText = @"
$($Language.HelpUsage)
.\$GetScriptName.ps1 [-h] [-c <ConfigFile>] [-i] [-d]
$($Language.HelpParam)
-h, -?, -Help
$($Language.Helphelp)
-c, -ConfigFile <ConfigFile>
$($Language.HelpConfig)
-i, -Install
$($Language.HelpInstall)
-d, -Download
$($Language.HelpDownload)
"@
Write-Output $helpText
exit 1
}

if ((-Not ($Install)) -and (-Not ($Download))) {
Show-Menu
}
elseif (($Install) -or ($Download)) {
Show-Welcome

if ($Download) {
Write-Host -ForegroundColor DarkGreen "`n$($Language.Starting -f $Language.ShowMenuTwo)`n"
Invoke-Office
Read-Host
}
if ($Install) {
Write-Host -ForegroundColor DarkGreen "`n$($Language.Starting -f $Language.ShowMenuThree)`n"
Install-Office
Read-Host
}
}
13 changes: 13 additions & 0 deletions lang/en-US/installer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,17 @@
ShowMenuFour = 'Change Configuration'
# You made an invalid selection.
ShowMenuInvalid = 'You made an invalid selection.'

# Usage:
HelpUsage = 'Usage:'
# Parameters:
HelpParam = 'Parameters:'
# Displays this help message.
Helphelp = 'Displays this help message.'
# Specifies the configuration file to be used.
HelpConfig = 'Specifies the configuration file to be used.'
# Triggers the installation process.
HelpInstall = 'Triggers the installation process.'
# Starts the download process.
HelpDownload = 'Starts the download process.'
}
14 changes: 14 additions & 0 deletions lang/tr-TR/installer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,18 @@
ShowMenuFour = 'Yapılandırmayı Değiştir'
# You made an invalid selection.
ShowMenuInvalid = 'Geçersiz bir seçim yaptınız.'

# Usage:
HelpUsage = 'Kullanım:'
# Parameters:
HelpParam = 'Parametreler:'
# Displays this help message.
Helphelp = 'Bu yardım mesajını görüntüler.'
# Specifies the configuration file to be used.
HelpConfig = 'Kullanılacak yapılandırma dosyasını belirtir.'
# Triggers the installation process.
HelpInstall = 'Kurulum sürecini başlatır.'
# Starts the download process.
HelpDownload = 'İndirme sürecini başlatır.'

}

0 comments on commit 4cc6214

Please sign in to comment.