# Definicja funkcji Unpin-App dla Outlook
function Unpin-Outlook {
    try {
        ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -like "*Outlook*"}).Verbs() | ?{$_.Name.replace('&','') -match 'Von "Start" lösen|Unpin from Start'} | ForEach-Object { $_.DoIt() }
        return "App 'Outlook' unpinned from Start"
    } catch {
        # Obsługa błędów bez wyświetlania komunikatów
        return "Error Unpinning App 'Outlook'"
    }
}

# Definicja funkcji Unpin-App dla Solitaire
function Unpin-Solitaire {
    try {
        ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -like "*Solitaire*"}).Verbs() | ?{$_.Name.replace('&','') -match 'Von "Start" lösen|Unpin from Start'} | ForEach-Object { $_.DoIt() }
        return "App 'Solitaire' unpinned from Start"
    } catch {
        return "Error Unpinning App 'Solitaire'"
    }
}

# Definicja funkcji Unpin-App dla Spotify
function Unpin-Spotify {
    try {
        ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -like "*Spotify*"}).Verbs() | ?{$_.Name.replace('&','') -match 'Von "Start" lösen|Unpin from Start'} | ForEach-Object { $_.DoIt() }
        return "App 'Spotify' unpinned from Start"
    } catch {
        return "Error Unpinning App 'Spotify'"
    }
}

# Definicja funkcji Unpin-App dla Grammarly
function Unpin-Grammarly {
    try {
        ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -like "*Grammarly*"}).Verbs() | ?{$_.Name.replace('&','') -match 'Von "Start" lösen|Unpin from Start'} | ForEach-Object { $_.DoIt() }
        return "App 'Grammarly' unpinned from Start"
    } catch {
        return "Error Unpinning App 'Grammarly'"
    }
}

# Definicja funkcji Unpin-App dla Luminar Neo - AI Photo Editor
function Unpin-LuminarNeo {
    try {
        ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -like "*Luminar Neo*"}).Verbs() | ?{$_.Name.replace('&','') -match 'Von "Start" lösen|Unpin from Start'} | ForEach-Object { $_.DoIt() }
        return "App 'Luminar Neo - AI Photo Editor' unpinned from Start"
    } catch {
        return "Error Unpinning App 'Luminar Neo - AI Photo Editor'"
    }
}

# Definicja funkcji Unpin-App dla Clipchamp - edytor wideo
function Unpin-Clipchamp {
    try {
        ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -like "*Clipchamp*"}).Verbs() | ?{$_.Name.replace('&','') -match 'Von "Start" lösen|Unpin from Start'} | ForEach-Object { $_.DoIt() }
        return "App 'Clipchamp - edytor wideo' unpinned from Start"
    } catch {
        return "Error Unpinning App 'Clipchamp - edytor wideo'"
    }
}

# Definicja funkcji Unpin-App dla To Do
function Unpin-ToDo {
    try {
        ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -like "*To Do*"}).Verbs() | ?{$_.Name.replace('&','') -match 'Von "Start" lösen|Unpin from Start'} | ForEach-Object { $_.DoIt() }
        return "App 'To Do' unpinned from Start"
    } catch {
        return "Error Unpinning App 'To Do'"
    }
}

# Definicja funkcji Unpin-App dla LinkedIN
function Unpin-LinkedIn {
    try {
        ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -like "*LinkedIN*"}).Verbs() | ?{$_.Name.replace('&','') -match 'Von "Start" lösen|Unpin from Start'} | ForEach-Object { $_.DoIt() }
        return "App 'LinkedIN' unpinned from Start"
    } catch {
        return "Error Unpinning App 'LinkedIN'"
    }
}

# Wywołanie funkcji Unpin-App dla każdej aplikacji
Unpin-Outlook
Unpin-Solitaire
Unpin-Spotify
Unpin-Grammarly
Unpin-LuminarNeo
Unpin-Clipchamp
Unpin-ToDo
Unpin-LinkedIn
