MS Server 2003 powershell script at system startup?

Posted on 2012-08-30
Last Modified: 2012-09-03
I have configured the following ps1 and it works fine.  How can I make this run at system startup, administrator logoff, etc...

$ping=New-Object System.Net.NetworkInformation.Ping;
$remoteIP = ""
$remoteIP = ""
$remoteIP = ""
$remoteIP = ""
$conn = "Wyless VPN1"
$login = "Telsc2"
$pass = "xxxx"
$a = 1
while ($a = 1) {
  if($vpn.Status -eq "Success") {
    Write-Host "VPN OK"
    Start-Sleep -Second 10
  else {
    rasdial $conn /d
    Start-Sleep -Second 2
    rasdial $conn $login $pass
Question by:dhuff2012
    LVL 52

    Accepted Solution

    Create System Startup / Shutdown and User Logon / Logoff Scripts

    Specify a Script to Run on Startup Shutdown Logon Logoff

    Overview of Logon, Logoff, Startup, and Shutdown Scripts

    - Rancy
    LVL 39

    Assisted Solution

    @dhuff2012: you can't set different IP address for one variable. In your example:
    $remoteIP = ""
    $remoteIP = ""
    $remoteIP = ""
    $remoteIP = ""
    only last IP ( will be pinged.
    As I've commented in your previous question, you can use scheduler for script starting during startup.

    Author Closing Comment

    Got it fixed.  Thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Imagine you have a shopping list of items you need to get at the grocery store. You have two options: A. Take one trip to the grocery store and get everything you need for the week, or B. Take multiple trips, buying an item at a time, to achieve t…
    A quick step-by-step overview of installing and configuring Carbonite Server Backup.
    Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now