SOLVED

Disable app from starting up

Bronze Contributor

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?

1 Reply
best response confirmed by AB21805 (Bronze Contributor)
Solution
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 best response

Accepted Solutions
best response confirmed by AB21805 (Bronze Contributor)
Solution
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

View solution in original post