Forum Discussion

AB21805's avatar
AB21805
Bronze Contributor
Apr 19, 2023
Solved

Disable app from starting up

Hi all,

 

I have set wordpad via powershell to open up on start up which I no longer need to

 

I used:

 

 #Create shortcut in all users startup folder

if (-not (Test-Path "C:\Users\Public\Desktop\RemoteApp.url"))

{

$null = $WshShell = New-Object -comObject WScript.Shell

$path = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\wordpad.url"

$targetpath = "C:\Program Files\Windows NT\Accessories\wordpad.exe"

$iconlocation = "C:\Program Files\Windows NT\Accessories\wordpad.exe"

$iconfile = "IconFile=" + $iconlocation

$Shortcut = $WshShell.CreateShortcut($path)

$Shortcut.TargetPath = $targetpath

$Shortcut.Save()

 

Add-Content $path "HotKey=0"

Add-Content $path "$iconfile"

Add-Content $path "IconIndex=0"

} 

 

 

How do I stop it from opening up on start up since I used the above script from intune. 

 

I want to remove it from start up via intune / powershell too. 

 

Any ideas?

  • I used # Specify the path of the WordPad shortcut in the startup folder
    $shortcutPath = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\wordpad.url"

    # Delete the WordPad shortcut if it exists
    if (Test-Path $shortcutPath) {
    Remove-Item $shortcutPath
    Write-Output "WordPad removed from startup."
    } else {
    Write-Output "WordPad shortcut not found in startup folder."
    }
    in the end which worked

1 Reply

  • AB21805's avatar
    AB21805
    Bronze Contributor
    I used # Specify the path of the WordPad shortcut in the startup folder
    $shortcutPath = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\wordpad.url"

    # Delete the WordPad shortcut if it exists
    if (Test-Path $shortcutPath) {
    Remove-Item $shortcutPath
    Write-Output "WordPad removed from startup."
    } else {
    Write-Output "WordPad shortcut not found in startup folder."
    }
    in the end which worked

Resources