This PowerShell script sample shows how to add an item to the Startup in Windows 8.
​Sometimes, users want programs to start when your system starts. Usually, you can add items to the startup folder. In Windows 8, adding items to Startup requires additional work. This script can resolve this problem.
Step1: To start Windows PowerShell with administrator privileges, and run the script in the Windows PowerShell Console, type the command:
Import-Module <Script Path> at the prompt.For example, type
Import-Module C:\Script\AddItemToStartup.psm1
This is shown in the following figure.

Step 2: Type the command Get-Help
Add-OSCStartup -Full to display the entire Help file for this function, such as the syntax, parameters, or examples.

Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.
If (Test-Path -Path $ItemPath)
{
#To get the item name
$ItemName = (Get-Item -Path $ItemPath).Name
If ($ComputerConfiguration)
{
$ComputerConfigDestination = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp"
AddItemToStartup -ItemName $ItemName -Destination $ComputerConfigDestination
}
Else
{
$UserConfigDestination = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup"
AddItemToStartup -ItemName $ItemName -Destination $UserConfigDestination
}
}
Else
{
Write-Warning "The path does not exist, plese input the correct path."
}
If (Test-Path -Path $ItemPath) { #To get the item name $ItemName = (Get-Item -Path $ItemPath).Name If ($ComputerConfiguration) { $ComputerConfigDestination = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp" AddItemToStartup -ItemName $ItemName -Destination $ComputerConfigDestination } Else { $UserConfigDestination = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup" AddItemToStartup -ItemName $ItemName -Destination $UserConfigDestination }} Else { Write-Warning "The path does not exist, plese input the correct path."}
Example 1: Type the following command in the Windows PowerShell Console:
Add-OSCStartup –ItemPath C:\Windows\System32\Taskmgr.exe

This command shows how to add an item to Startup in Windows 8.
Example 2: Type the following command in the Windows PowerShell Console:
Add-OSCStartup –ItemPath C:\Windows\System32\Taskmgr.exe
–ComputerConfiguration
This command shows how to add an item to Startup in Windows 8 and apply the command to the computer.
Windows PowerShell 2.0