How to import-csv from Onenote?

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 1 year, 10 months ago.

  • Author
    Posts
  • #22355
    Profile photo of Daniel Brooks
    Daniel Brooks
    Participant

    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
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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.

You must be logged in to reply to this topic.