次の方法で共有


移行ガイダンスをWindows 10するための OneNote

重要

OneNote for Windows 10 は、2025 年 10 月にサポートが終了します。 エンタープライズのお客様は、Windows 10の OneNote から Windows 上の OneNote に切り替える必要があります。これは、Microsoft Store と Microsoft 365 サブスクリプションから入手できます。 Windows 上の OneNote には新しい機能と更新プログラムが用意されており、グループ ポリシーを使用してユーザー設定をカスタマイズできます。

この記事では、Organizationを OneNote for Windows 10 から OneNote for Windows に移行するためのガイダンスを提供します。 これには、ユーザーの識別、移行スクリプトのカスタマイズ、プロセス全体のデータ整合性の確保に関する手順が含まれています。 移行中の中断を最小限に抑え、ユーザー データを保護するために役立つトラブルシューティング手順とベスト プラクティスを確認できます。

Windows 10の OneNote でのユーザーの識別:

Microsoft Intuneを使用して OneNote for Windows 10を使用してorganization内のユーザーまたはデバイスを識別するには、次の手順に従ってレポートを実行します。

  • Intuneで、[ すべてのサービス>Apps |Monitor>Monitor>検出されたアプリ、次に "Office.OneNote" を検索します。
  • 16001.xxxxx.xxxxx.x以降のアプリケーション バージョンを探して、Windows 10 ユーザーの OneNote を識別します。 最新バージョンは 16001.14326.22094.0

    注:

    サンプル移行スクリプトは、バージョン上のWindows 10 デバイスに対してのみ OneNote で動作します16001.14326.22094.0

サンプル スクリプトのカスタマイズ

サンプル スクリプトを実行する前に、アプリがインストールされていない場合は、ユーザー デバイスに OneNote を Windows にインストールします。 詳細については、「OneNote の展開ガイド」を参照してください。

OneNote for Windows へのスムーズな移行を確実に行うには、次のサンプル スクリプトをカスタマイズして、これらの手順を順番に完了する必要があります。

  1. Windows 10の OneNote がインストールされているかどうかを確認し、アプリの AppData フォルダーへのパスが存在するかどうかを確認して (ユーザーが以前にアプリを開いたかどうかを示します)、移行が必要かどうかを確認します。
  2. OneNote for Windows がインストールされているかどうかを確認するには、実行可能ファイルがデバイスに存在するかどうかを確認します。
  3. 移行中にデータが失われるのを防ぐための重要な機能を備えた最新バージョンであることを確認するには、OneNote のバージョンを確認してWindows 10します。

注:

このスクリプトは、16001.14326.22094 より下のバージョンのWindows 10の OneNote を持つデバイスでは機能しません。 IT 管理者は、organizationのポリシーに従ってこれらのデバイスをアップグレードする必要があります。

Appx ダウンロードを使用してユーザーを最新バージョンにアップグレードするには、次のコマンドを実行します。
WinGet download 9wzdncrfhvjl --skip-license

  1. Windows 10プロセスのすべての OneNote を終了します。
  2. onenote-uwp://backup: コマンドを使用して、同期されていないセクションをサンドボックス フォルダーにバックアップします。
  3. サンドボックス内にバックアップを格納します。
    $localAppDataPath\Packages\Microsoft.Office.OneNote_8wekyb3d8bbwe\AppData\Local\OneNote\16.0\BackUp\.
  4. 同期されていないコンテンツを含むセクションのみがバックアップされ、各フォルダーがノートブックに対応するフォルダーに編成されていることを確認します。
  5. UWPBackUpStatus.jsonを解析して、バックアップが成功したことを検証します。

警告

バックアップが失敗した状態でアンインストールすると、データが失われる可能性があります。

  1. サンドボックスの外部の場所にバックアップ ファイルを移動します。
    $localAppDataPath\Packages\Microsoft.Office.OneNote_8wekyb3d8bbwe\
    サンドボックス パスは、Windows 10 アプリの OneNote がアンインストールされると削除されるためです。
  2. OneNote for Windows 10をアンインストールします。
  3. OneNote for Windows 10が、デバイスごとにではなく、ユーザーごとにアンインストールされていることを確認します。
    このプロセスは、共有デバイスがすべてのアカウントに対して同期されていないメモを削除するシナリオを軽減するのに役立ちます。

重要

サンプル スクリプトを使用する前に、organizationの特定のデプロイと移行の要件に合わせてカスタマイズする必要があります。

#############################################
######   OneNote for Windows 10  ############
######   External Migration Script v6  ######
#############################################

## Optional: Helper function to write logs from script to UWPMigrationResult.log File and Console ##
function writeLogsToFileAndConsole {
    Param ([string]$logstring)
    $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
    $logstringWithTimestamp = "[$timestamp] $logstring"
    $backupFolder = [System.Environment]::GetFolderPath('LocalApplicationData') + "\Microsoft\OneNote\16.0\Backup"
    $outputFile = $backupFolder + "\UWPMigrationResult.log"

    if (-not (Test-Path $backupFolder))
    {
        New-Item -Path $backupFolder -ItemType Directory
    }

    if (-not (Test-Path $outputFile))
    {
        New-Item -Path $outputFile -ItemType File
    }

    Add-content $outputFile -value "$logstringWithTimestamp"
    Write-Host "$logstringWithTimestamp"
}

## Check if OneNote for Windows 10 is installed and if the AppData path exists ##
function checkOneNoteUWPInstall {
    $folderPath = "$env:LOCALAPPDATA\Packages\Microsoft.Office.OneNote_8wekyb3d8bbwe\LocalState\AppData\Local\OneNote"
    $uwpApp = Get-AppxPackage | Where-Object {$_.Name -eq "Microsoft.Office.OneNote"}
    if ($null -ne $uwpApp)
    {
        $uwpVersion = $uwpApp.Version
        $uwpVersionObject = [System.Version]$uwpVersion
        writeLogsToFileAndConsole "OneNote UWP app version: $uwpVersion"
    }
    else {
        writeLogsToFileAndConsole "OneNote UWP App is not installed"
        exit
    }

    if (Test-Path $folderPath)
    {
        Write-Host "OneNote UWP AppData folder detected"
    }
    else {
        ($null -ne $uwpApp) 
        $uwpApp | Remove-AppxPackage
        writeLogsToFileAndConsole "OneNote AppData folder does not exist and OneNote UWP will now be uninstalled"
        exit
    }
}

## Check if OneNote for Windows is installed by checking the existence of the executable file ##
function checkOneNoteWin32Install {
    $oneNotePath = Join-Path $env:ProgramFiles "Microsoft Office\root\Office16\ONENOTE.EXE"
    
    if (Test-Path $oneNotePath) {
        writeLogsToFileAndConsole "OneNote Win32 is installed"   
    } else {
        writeLogsToFileAndConsole "OneNote Win32 is not installed"
        exit
    }
 }

## Check version of the user's OneNote for Windows 10 app ##
function checkUWPVersion {
    $uwpApp = Get-AppxPackage | Where-Object {$_.Name -eq "Microsoft.Office.OneNote"}
    if ($null -ne $uwpApp)
    {
        $uwpVersion = $uwpApp.Version
        $uwpVersionObject = [System.Version]$uwpVersion

        $updatedVersion = "16001.14326.22094.0"
        $updatedVersionObject = [System.Version]$updatedVersion

        $unsupportedVersion = "16001.14327.10000.0"
        $unsupportedVersionObject = [System.Version]$unsupportedVersion

        if ($uwpVersionObject -ge $unsupportedVersionObject)
        {
            writeLogsToFileAndConsole "Unsupported version of OneNote UWP app. Please check the Microsoft Store for updates"
            exit
        }

        if ($uwpVersionObject -lt $updatedVersionObject)
        {
            writeLogsToFileAndConsole "You must upgrade OneNote UWP to a version higher than 16.0.14326.21802. Please check the Microsoft Store"
            exit
        }
        else
        {
            writeLogsToFileAndConsole "OneNote UWP will backup and uninstall"
        }
    }
    else
    {
        writeLogsToFileAndConsole "No OneNote UWP detected therefore no need for migration"
        exit
    }
}

## Terminate the OneNote for Windows 10 app before executing the rest of the migration script ##
function killProcess {
    if (Get-Process -Name "OneNoteIm" -ErrorAction SilentlyContinue)
    {
        try
        {
            $uwpProcess = Get-Process -Name "OneNoteIm"
            Stop-Process -Id $uwpProcess.Id -Force
            Start-Sleep -Seconds 10
        }
        catch
        {
            writeLogsToFileAndConsole "An error occurred when killing the current OneNote UWP process: $($_.Exception.GetType().FullName)"
            writeLogsToFileAndConsole "$($_.Exception.Message)"
            exit
        }

        writeLogsToFileAndConsole "OneNote UWP process killed"
    }
}

## Run the protocol to back up unsynced sections into the sandbox path ##
function launchBackUp {
    try
    {
        Start-Process "onenote-uwp://backup:"
        Start-Sleep -Seconds 60
        writeLogsToFileAndConsole "OneNote UWP backup initiated"
    }
    catch
    {
        writeLogsToFileAndConsole "An error occurred when starting the backup: $($_.Exception.GetType().FullName)"
        writeLogsToFileAndConsole "$($_.Exception.Message)"
        exit
    }

    writeLogsToFileAndConsole "OneNote UWP backup in progress"
}

## Parse the results in the json files to validate that the backup was successful ##
function parseJson {
    try
    {
        $localAppDataPath = [System.Environment]::GetFolderPath('LocalApplicationData')
        $jsonPath = "$localAppDataPath\Packages\Microsoft.Office.OneNote_8wekyb3d8bbwe\LocalState\AppData\Local\OneNote\16.0\UWPBackUpStatus.json"
        if(!(test-path $jsonPath))
        {
            writeLogsToFileAndConsole "Backup Json file path is not valid"
            exit
        }

        $backupJsonFileContent = Get-Content -Path $jsonPath -Raw | ConvertFrom-Json
        $status = $backupJsonFileContent."UWP Backup Status"
        if ($status -eq "Completed")
        {
            $jsonPath2 = "$localAppDataPath\Packages\Microsoft.Office.OneNote_8wekyb3d8bbwe\LocalState\AppData\Local\OneNote\16.0\UWPSyncStatus.json"
            if(test-path $jsonPath2)
            {
                $syncStatusJsonContent = Get-Content -Raw -Path $jsonPath2
                $syncStatusJsonObject = COnvertFrom-Json $syncStatusJsonContent
                foreach ($key in $syncStatusJsonObject.PSObject.Properties)
                {
                    $value = $syncStatusJsonObject.$($key.Name)
                    if ($value.StartsWith("Contains pending outbounding changes: true,"))
                    {
                        if ($backupJsonFileContent."Number of sections Backed up" -eq 0)
                        {
                            writeLogsToFileAndConsole "No error occurred when backing up but outbounding changes were not backed up successfully"
                            exit
                        }
                        else
                        {
                            break
                        }
                    }
                }
            }

            writeLogsToFileAndConsole "OneNote UWP backup is completed and status is saved"
        }
        elseif ($status -eq "")
        {
            writeLogsToFileAndConsole "$status"
            writeLogsToFileAndConsole "No error occurred but backup did not finish. We cannot continue migration. Consider increasing the Start-Sleep time in line 130 and rerun the script"
            exit
        }
        else
        {
            writeLogsToFileAndConsole "No error occurred but backup status is $status. We cannot continue migration. Consider increasing the Start-Sleep time in line 130 and rerun the script"
            exit
        }
    }
    catch
    {
        writeLogsToFileAndConsole "An error occurred when finishing the backup: $($_.Exception.GetType().FullName)"
        writeLogsToFileAndConsole "$($_.Exception.Message)"
        exit
    }
}

## Copy the backup files to a directory outside of the sandbox path ##
function moveBackup {
    try
    {
        $localAppDataPath = [System.Environment]::GetFolderPath('LocalApplicationData')
        $sourcePath = "$localAppDataPath\Packages\Microsoft.Office.OneNote_8wekyb3d8bbwe\LocalState\AppData\Local\OneNote\16.0\BackUp\"
        $destinationPath = [System.Environment]::GetFolderPath('LocalApplicationData') + "\Microsoft\OneNote\16.0\Backup\"

        Copy-Item -Path $sourcePath\* -Destination $destinationPath -Recurse -Force

        $sourcePath = "$localAppDataPath\Packages\Microsoft.Office.OneNote_8wekyb3d8bbwe\LocalState\AppData\Local\OneNote\16.0"
        $fileExtensions = "*.json", "*.txt"
        foreach ($fileExtension in $fileExtensions)
        {
            $files = Get-ChildItem -Path $sourcePath -Filter $fileExtension
            foreach ($file in $files)
            {
                Copy-Item -Path $file.FullName -Destination $destinationPath -Force
            }
        }
    }
    catch
    {
        writeLogsToFileAndConsole "An error occurred when moving the backup files: $($_.Exception.GetType().FullName)"
        writeLogsToFileAndConsole "$($_.Exception.Message)"
        exit
    }

    writeLogsToFileAndConsole "Backup files copied successfully from $sourcePath to $destinationPath"
 }

## Uninstall the OneNote for Windows 10 app ##
function uninstallUWP {
    $uwpApp = Get-AppxPackage | Where-Object {$_.Name -eq "Microsoft.Office.OneNote"}
    if ($null -ne $uwpApp)
    {
        $uwpApp | Remove-AppxPackage
        writeLogsToFileAndConsole "OneNote UWP version uninstalled"
    }
}

function MainRoutine {
    checkOneNoteWin32Install
    checkOneNoteUWPInstall
    checkUWPVersion
    killProcess
    launchBackUp
    parseJson
    moveBackup
    uninstallUWP
}

## Executes the main routine ##
MainRoutine

移行されたノートへのアクセス

移行後、ユーザーは次の方法でノートを取得できます。

  1. Windows アプリケーションで新しい OneNote を 開きます。
  2. 自分のアカウントにサインインします。
  3. ノートブックを開きます。

メモがない場合は、前の手順で作成したバックアップ フォルダーをチェックします。

Windows 上の OneNote を使用してバックアップを確認するには:

  • [ファイル] -> [バックアップを開く] に移動します。>バックアップ ファイル のパスに移動します。

トラブルシューティング

  • バックアップと同期の状態の詳細については、ユーザーのバックアップ フォルダー内の UWPBackupStatus.json ファイルと UWPSyncStatus.json ファイルを確認します。

  • 移行中に発生したエラーについては、前に生成したバックアップにあるログ ファイルを参照してください (手順 1.d)。

onenote-uwp://backup: コマンドが失敗した場合:

  • OneNote for Windows 10 アプリが、onenote-uwp プロトコルにリンクされている既定のアプリであることを確認します。
  • 関連するサポート記事を参照して、Windows 10の OneNote への正しいプロトコルの添付ファイルを確認してください。

注意

オンラインで見つかったコマンドを使用する場合は注意してください。 Remove-AppxPackage コマンドの結果など、意図しない結果を避けるために、organization全体に展開する前に、制御された環境でコマンドを常にテストします。

その他のサポートや問い合わせは、Microsoft サポートにお問い合わせください。