次の方法で共有


移行ガイダンスを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 for Windows へのスムーズな移行を確実に行うには、組織は次のサンプル スクリプトをカスタマイズしてこれらの機能を完了する必要があります。

  • ユーザー デバイスに OneNote を Windows にインストールします。 詳細については、「OneNote の展開ガイド」を参照してください。

  • Updates OneNote を最新のビルドにWindows 10して、重要な機能を組み込み、同期されていないノートの移行中のデータ損失を防ぎます。

    注:

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

  • Windows 10 プロセスのすべての OneNote を終了します。

  • onenote-uwp://backup: コマンドを使用して、同期されていないノートブックをユーザーのバックアップ フォルダーにバックアップします。

    • ただし、バックアップはC:\temp\OneNoteMigrationに保存されますが、organizationのニーズに合わせてパスを自由に編集できます。
    • 各バックアップでは、このパス内に同期されていないセクションを含むノートブックごとに対応するフォルダーが作成されます。
  • UWPBackUpStatus.jsonを解析して、バックアップが成功したことを検証します。

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

      注:

      バックアップを実行するには、OneNote for Windows をインストールし、OneNote for Windows 10をバージョン 16001.14326.22094 以降に更新する必要があります。

  • OneNote for Windows 10をアンインストールします。

    • OneNote for Windows 10がデバイスベースではなくユーザーベースでアンインストールされていることを確認します。 このプロセスは、共有デバイスがすべてのアカウントに対して同期されていないメモを削除するシナリオを軽減するのに役立ちます。

重要

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

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

## Creates backupFolder and writes log 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"
}

## Checks if OneNote UWP is installed and if app data exists, writes version to log file and console ##

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 "UWP OneNote app version: $uwpVersion"
    } else {
        writeLogsToFileAndConsole "OneNote UWP App is not installed"
    exit
    }

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

## Checks if OneNote Win32 is installed by checking the existence of the executable file and checks the version ##

function checkOneNoteWin32Install {
    $oneNotePath = Join-Path $env:ProgramFiles "Microsoft Office\root\Office16\ONENOTE.EXE"
    $registryPath = "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration"
    $versionValueName = "ClientVersionToReport"
    $registry = Get-ItemProperty -Path $registryPath
    
    if (Test-Path $oneNotePath) {
        if ($registry.PSObject.Properties[$versionValueName]) {
            $versionValue = $registry.$versionValueName
            writeLogsToFileAndConsole "OneNote Win32 Version Value: $versionValue is installed at path $oneNotePath"   
    } else {
        writeLogsToFileAndConsole "OneNote Win32 is not installed"
        exit
    }
 }   

## Checks for backup folder path
  
    $registryPath = "HKCU:\SOFTWARE\Microsoft\Office\16.0\OneNote\Options\Paths"
    $backupValueName = "BackupFolderPath"
    if (Test-Path $registryPath) {
        $registry = Get-ItemProperty -Path $registryPath
        if ($registry.PSObject.Properties[$backupValueName]) {
            $backupValue = $registry.$backupValueName
            writeLogsToFileAndConsole "OneNote Win32 Backup Path Value: $backupValue"
        }
    }
}

## Updates OneNote for Windows 10 to the latest version available ##

function updateUWPVersion {
    $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
    }
}
## Terminates 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"
    }
}

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"
}

## Parses 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
    }
}

## Copies the backup files to the local app data folder ##

 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"
 }

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
    updateUWPVersion
    launchBackUp
    killProcess
    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 サポートにお問い合わせください。