Solved

need assistance with this script to only have it run once at logon

Posted on 2015-02-20
2
93 Views
Last Modified: 2015-02-20
can someone provide additional logic I can use on this script to ensure that it is only run once and not every time the user logs in.

@echo off
netsh wlan add profile filename="\\myserver.com\secure wifi\HQsecure.xml"
netsh wlan set profileorder name=HQSECURE  interface=*  priority=1

Open in new window


thx in advance,

Michael
0
Comment
Question by:siber1
2 Comments
 
LVL 78

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
ID: 40622496
create a file or a directory and if it exists don't execute the commands

$netshpath = $env:programdata + "\\netsh.done"
if (!(test-path $netshpath))
{
netsh wlan add profile filename="\\myserver.com\secure wifi\HQsecure.xml"
netsh wlan set profileorder name=HQSECURE  interface=*  priority=1
cd $env:programdata
md netsh.done
}

Open in new window

here is one way
0
 

Author Closing Comment

by:siber1
ID: 40622577
thanks David!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Resolve DNS query failed errors for Exchange
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

708 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

13 Experts available now in Live!

Get 1:1 Help Now