Solved

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

Posted on 2015-02-20
2
100 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 79

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
Last week, our Skyport webinar on “How to secure your Active Directory” (https://www.experts-exchange.com/videos/5810/Webinar-Is-Your-Active-Directory-as-Secure-as-You-Think.html?cid=Gene_Skyport) provided 218 attendees with a step-by-step guide for…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

773 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