asked on
ASKER
'===================================================================
Dim Man, blnCopied
Dim WshShell, objFileSys, sWinDir, sSysDir, strScriptDir
Dim arrFiles, strFile
'-----------------------------------------------------------------
'Setting of scripting objects
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFileSys = CreateObject("Scripting.FileSystemObject")
'=====================================================================================
'Set the file names here
'MAKE SURE THE WHOLE BASE FILE NAME IS PART OF THE SYSTE MANUFACTURER THAT IS THE TARGET
'eg, the file name DELL is in DELL Inc, which is the manufacturer
arrFiles = Array("DELL.p10", "IBM.p10")
'=====================================================================================
'Force path formats to a known format, ie, ending in a backslash
strComputer = "."
sWinDir = objFileSys.GetSpecialFolder(0).Path
If Right(sWinDir,1) <> "\" Then sWinDir = sWinDir & "\"
sSysDir = objFileSys.GetSpecialFolder(1).Path
If Right(sSysDir,1) <> "\" Then sSysDir = sSysDir & "\"
strScriptDir = objFileSys.GetParentFolderName(WScript.ScriptFullName)
If Right(strScriptDir,1) <> "\" Then strScriptDir = strScriptDir & "\"
'===================================================================================================
'Verify profile files are in same folder as script
For Each strFile In arrFiles
If Not objFileSys.FileExists(strScriptDir & strFile) Then
'WScript.Echo "Unable to locate " & strScriptDir & strFile, vbCritical, "Error!"
WScript.Quit 1
End If
Next
'====================================================================================================
' Get Manufacturer of the Computer System
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_ComputerSystem",,48)
For Each objItem in colItems
Man = objItem.Manufacturer
Next
'===================================================================================
If objFileSys.FileExists("C:\Progra~1\Intel\Wireless\Bin\PfWizard.exe") Then
For Each strFile In arrFiles
'Execute Wireless configuration Profile
If InStr(LCase(Man), LCase(Left(strFile, InStrRev(strFile, ".") - 1)) Then
objFileSys.CopyFile strScriptDir & strFile, "C:\WINDOWS\Temp\", True
WshShell.Run "C:\WINDOWS\Temp\" & strFile, 1, True
End If
Next
End if
'====================================================================================
blnCopied = True
For Each strFile In arrFiles
If objFileSys.FileExists("C:\WINDOWS\Temp\" & strFile) = False Then blnCopied = False
Next
If blnCopied = False Then
WScript.Quit 1
Else
WScript.Quit 0
End If
'==================================== The End ================================
ASKER
ASKER
ASKER
'===================================================================
Dim Man, blnCopied
Dim WshShell, objFileSys, sWinDir, sSysDir, strScriptDir
Dim arrFiles, strFile
'-----------------------------------------------------------------
'Setting of scripting objects
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFileSys = CreateObject("Scripting.FileSystemObject")
'=====================================================================================
'Set the file names here
'MAKE SURE THE WHOLE BASE FILE NAME IS PART OF THE SYSTE MANUFACTURER THAT IS THE TARGET
' For example, for a DELL system, enter DELL-ProfileName.p10
' The hyphen must be included
'eg, the file name DELL is in DELL Inc, which is the manufacturer
arrFiles = Array("DELL-ProfileName.p10", "IBM-ProfileName.p10")
'=====================================================================================
'Force path formats to a known format, ie, ending in a backslash
strComputer = "."
sWinDir = objFileSys.GetSpecialFolder(0).Path
If Right(sWinDir,1) <> "\" Then sWinDir = sWinDir & "\"
sSysDir = objFileSys.GetSpecialFolder(1).Path
If Right(sSysDir,1) <> "\" Then sSysDir = sSysDir & "\"
strScriptDir = objFileSys.GetParentFolderName(WScript.ScriptFullName)
If Right(strScriptDir,1) <> "\" Then strScriptDir = strScriptDir & "\"
'===================================================================================================
'Verify profile files are in same folder as script
For Each strFile In arrFiles
If Not objFileSys.FileExists(strScriptDir & strFile) Then
'WScript.Echo "Unable to locate " & strScriptDir & strFile, vbCritical, "Error!"
WScript.Quit 1
End If
Next
'====================================================================================================
' Get Manufacturer of the Computer System
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_ComputerSystem",,48)
For Each objItem in colItems
Man = objItem.Manufacturer
Next
'===================================================================================
If objFileSys.FileExists("C:\Progra~1\Intel\Wireless\Bin\PfWizard.exe") = True Or objFileSys.FileExists("C:\Progra~1\Intel\WiFi\Bin\PfWizard.exe") = True Then
For Each strFile In arrFiles
'Execute Wireless configuration Profile
If InStr(LCase(Man), LCase(Left(strFile, InStr(strFile, "-") - 1))) > 0 Then
objFileSys.CopyFile strScriptDir & strFile, "C:\WINDOWS\Temp\", True
WshShell.Run "C:\WINDOWS\Temp\" & strFile, 1, True
End If
Next
End if
'====================================================================================
blnCopied = True
For Each strFile In arrFiles
If objFileSys.FileExists("C:\WINDOWS\Temp\" & strFile) = False Then blnCopied = False
Next
If blnCopied = False Then
WScript.Quit 1
Else
WScript.Quit 0
End If
'==================================== The End ================================
ASKER
ASKER
For Each strFile In arrFiles
'Execute Wireless configuration Profile
MsgBox "Manufacturer: " & LCase(Man) & VbCrLf & "Looking for " & LCase(Left(strFile, InStr(strFile, "-") - 1))
If InStr(LCase(Man), LCase(Left(strFile, InStr(strFile, "-") - 1))) > 0 Then
objFileSys.CopyFile strScriptDir & strFile, "C:\WINDOWS\Temp\", True
WshShell.Run "C:\WINDOWS\Temp\" & strFile, 1, True
End If
Next
For Each strFile In arrFiles
'Execute Wireless configuration Profile
MsgBox "Manufacturer: " & LCase(Man) & VbCrLf & "Looking for " & LCase(Left(strFile, InStr(strFile, "-") - 1))
If InStr(LCase(Man), LCase(Left(strFile, InStr(strFile, "-") - 1))) > 0 Then
MsgBox "Manufacturer matched. Copying " & strFile
objFileSys.CopyFile strScriptDir & strFile, "C:\WINDOWS\Temp\", True
MsgBox "Running C:\WINDOWS\Temp\" & strFile
WshShell.Run "C:\WINDOWS\Temp\" & strFile, 1, True
Else
MsgBox "Manufacturer not matched. Not copying " & strFile
End If
Next
ASKER
ASKER
ASKER
VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.
TRUSTED BY
http://www.symantec.com/connect/downloads/automating-wireless-profile-config-settings-intel-prosetwireless-software-11113-swdds
It looks you set up an Admin profile set, and deploy it. I'm not sure whether it would automatically remove other profiles.
Rob.