Solved

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

Posted on 2015-02-20
2
104 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 81

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

Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

Question has a verified solution.

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
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 …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

717 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