Solved

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

Posted on 2015-02-20
2
101 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 80

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

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.
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
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 …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

820 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