How to import-csv from Onenote?

Welcome Forums General PowerShell Q&A How to import-csv from Onenote?

This topic contains 1 reply, has 2 voices, and was last updated by

 
Keymaster
3 years, 8 months ago.

  • Author
    Posts
  • #22355

    Participant
    Points: 0
    Rank: Member

    Here's the scenario. I've created a script to ping a CSV of servers and alert which servers are offline. Normally, I have it pull the list from my desktop, but we use a shared IT notebook that i've imported the CSV into that I'd like it to pull from instead since we're constantly updating server information.

    Here's what I have so far:

    While($True)
    {
    try
    {
    $ServerList = Import-Csv -Path C:\users\AlertPC\desktop\ip.csv -Header "Name","Description","Ipaddress"
    foreach ($s in $ServerList) {
    If (!(Test-Connection -ComputerName $s.Name -Quiet -Count 1)) {
    Write-Host -foregroundcolor "green" "$PCName went Offline on $date"
    [Console]::Beep(800,1000)
    $date = Get-Date -format F
    $PCName = $s.Name
    $PCDescription = $s.Description
    $PCIpaddress = $s.Ipaddress
    $msSam = New-Object -ComObject SAPI.SPVoice
    $msSam.Speak("$PCDescription went offline")
    }
    }
    }
    catch
    {
    Write-Host -foregroundcolor "red" "Double-check your code. Something broke."
    }
    Start-Sleep -Seconds 5
    }

  • #22357

    Keymaster
    Points: 3
    Rank: Member

    I'm not aware of an API to extract information from OneNote.

    It might make more sense to put this information into an actual database, like SQL Server Express, which is designed for data insert/update/query. OneNote isn't really a database.

The topic ‘How to import-csv from Onenote?’ is closed to new replies.