Jump to content
Sign in to follow this  
Chimaera

Remove wireless profile XP

Recommended Posts

Chimaera

Hey im working on a script as the last thing we run at work to check loads of stuff have been done activation / updates etc etc

One of the things is to remove our tech wirless profile so it stops people coming near the shop and logging in etc

Now the vista and above part is fine

RunWait(@ComSpec & " /c " & 'netsh wlan delete profile name="profile to remove"',@SW_SHOW)

but i cant use netsh in Windows XP

So im looking at devcon to do that

most of the stuff ive found deals with enable or disable wireless card, which i dont want to do

All i want to do is remove the profile so it cant start

does remove switch in devcon cover that event? e.g. below

devcon remove "profile to remove"

Or does it not work like that?

  • Like 1

Share this post


Link to post
Share on other sites
Reg2Post

You can maybe modify the registry key that has the wireless profiles to clear them out but I am not sure you can be selective (clears all).

Share this post


Link to post
Share on other sites
Chimaera

Clear all wouldn't be a problem unless it was a repaired laptop.

It would be best if i can just remove the one i need.

Hopefully a devcon expert will pass by..

Share this post


Link to post
Share on other sites
Chimaera

Done a load more with Devcon and its not the way forward, after some testing at work it will quite happily disable the wifi but i need it working and just remove the profile instead.

Ive had a look through the registry but ill check tommoz on an XP machine to be sure if there are any suitable keys

Is there any autoit code that works with xp?

Has anyone any suggestions on the way forward?

Share this post


Link to post
Share on other sites
guinness

Why can't you use netsh on XP?

Have a look here >> some custom scripts using netsh.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Chimaera

Because

Netsh wlan command exists only in Windows Vista, Windows 7 and in Windows Server 2008 and not for XP.

The wlan addition came along later on..

Ill have a look at you Delete_SSID code though bit more elegant than mine

Thx

Share this post


Link to post
Share on other sites
guinness

Sorry about that, I haven't coded on XP in a long time and forgot about that.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Chimaera

No worries

Its a pain but its probably possible, in the shop we get loads of different types and XP still is common amongst the masses.

Hence why im trying to sort this

We still see win 95 ,98 and 2000 now and again, i had to do a format and reinstall of 98 the other day (now where are my floppies) ;)

Edited by Chimaera

Share this post


Link to post
Share on other sites
JFX

There is a function _Wlan_DeleteProfile() that should work on XP

Share this post


Link to post
Share on other sites
Chimaera

Yes i found that one during my searches but i couldnt get it to work

$sProfileName = "wireless name"
$RemoveProfile = _Wlan_DeleteProfile($sProfileName)

; #FUNCTION# ====================================================================================================================
; Name...........: _Wlan_DeleteProfile
; Description ...: Deletes a profile from the profile list.
; Syntax.........: _Wlan_DeleteProfile($sProfileName)
; Parameters ....: $sProfileName - The name of the profile to delete.
; Return values .: Success - True
;                 Failure - False
;                 @Error
;                 |0 - No error.
;                 |1 - DllCall error. (@extended - DllCall error code.)
;                 |2 - API error. (@extended - API error code. (http://msdn.microsoft.com/en-us/library/ms681381.aspx))
; Author ........: MattyD
; Modified.......:
; Remarks .......: If an API error occurs and $fDebugWifi is not null, a reason for the error will be written to the console.
; Related .......: _Wlan_SetProfile
; Link ..........:
; Example .......:
; ===============================================================================================================================
Func _Wlan_DeleteProfile($sProfileName)
_WinAPI_WlanDeleteProfile($hClientHandle, $pGUID, $sProfileName)
If @error Then Return SetError(@error, @extended, _Wlan_ReportAPIError(@error, @extended, 0, @ScriptLineNumber, "_WinAPI_WlanDeleteprofile"))
Return True
EndFunc

unless im doing it wrong

Share this post


Link to post
Share on other sites
Chimaera

I retraced my steps and put

AutoItObject.au3

NativeWifi.au3

oLinkedList.au3

in a folder and used 04-2 ProfileList.au3 tutorial mainly the bits at the bottom

_Wlan_DeleteProfile("my profile name")
_Wlan_DeleteProfile("Renamed Profile (Prof 2)")
_Wlan_DeleteProfile("My Profile3 - Per User")

I ended up with this error

!APIError @Ln[5437] _WinAPI_WlanOpenHandle - The service has not been started.
C:Users**Wifi delete testnativewifi.au3 (2282) : ==> Only Object-type variables allowed in a "With" statement.:
With $oKeyClass
With ^ ERROR
->08:32:01 AutoIT3.exe ended.rc:1

so im still missing something

Edited by Chimaera

Share this post


Link to post
Share on other sites
MattyD

Hey man, you will need to take autoitobject.dll as well...

Quite a while back I was developing a "netsh wlan" clone for XP - I think it was pretty much complete - would you like me to find it for you?

Cheers,

Matt

Share this post


Link to post
Share on other sites
storme

I wouldn't mind hearing about that solution either.

I've run into a similar problem and had a think about how I would do it.

So some suggestions for the script (you've probabably already thought of:))

The script sets up the Office WIFI

The script sets itself up for autostart (just in case a tech doesn't remove it before it leaves the store)

On each startup

Wait 30-40 seconds

Check if the stores wifi is present

If it isn't then delete WIFI

Remove the autostart

Then selfdestruct

Anyway those were my thoughts.......... better shared than kept secret ;)

Share this post


Link to post
Share on other sites
Chimaera

The way this script is panning out is

A gui with tick or crosses against certain conditions

Is the machine activated

Has the software pack we use been installed

are the windows updates done

Has the correct background been applied

Has the device manager any errors

and a number of other checks before the machine leaves the shop

if all items are ticked it allows a button that creates a tech restore point and deletes the wireless drivers and a couple of other things like eject the cd draw as the tech have a habit of leaving os discs in them etc etc

Then the machine is ready to goto customer

Thats what im planning as a last check to make sure the lazy fooks do their job....

Share this post


Link to post
Share on other sites
Chimaera

But its bad really when i have to make this stuff, shame they can t be responsible and do the checks themselves ...

Opening a CD drawer by code to look for the windows disc ... really!!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×