한 번만 실행하면 Wi-Fi 자동 연결 설정이 완료되는 PowerShell 스크립트 > 소스정보

본문 바로가기
사이트 내 전체검색


소스정보

 

한 번만 실행하면 Wi-Fi 자동 연결 설정이 완료되는 PowerShell 스크립트

페이지 정보

본문

2e0fef65916271409a0a3dde0146474f_1745376326_6168.png
 

# 사용자 입력

$ssid = Read-Host "자동 연결할 Wi-Fi SSID 입력"

$password = Read-Host "Wi-Fi 비밀번호 입력" -AsSecureString


# 비밀번호 평문 변환

$plainPassword = [Runtime.InteropServices.Marshal]::PtrToStringAuto(

    [Runtime.InteropServices.Marshal]::SecureStringToBSTR($password)

)


# XML Wi-Fi 프로파일 생성

$xml = @"

<?xml version="1.0"?>

<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">

    <name>$ssid</name>

    <SSIDConfig>

        <SSID>

            <name>$ssid</name>

        </SSID>

    </SSIDConfig>

    <connectionType>ESS</connectionType>

    <connectionMode>auto</connectionMode>

    <MSM>

        <security>

            <authEncryption>

                <authentication>WPA2PSK</authentication>

                <encryption>AES</encryption>

                <useOneX>false</useOneX>

            </authEncryption>

            <sharedKey>

                <keyType>passPhrase</keyType>

                <protected>false</protected>

                <keyMaterial>$plainPassword</keyMaterial>

            </sharedKey>

        </security>

    </MSM>

    <MacRandomization xmlns="http://www.microsoft.com/networking/WLAN/profile/v3">

        <enableRandomization>false</enableRandomization>

    </MacRandomization>

</WLANProfile>

"@


# 임시 파일 경로

$tempFile = "$env:TEMP\$ssid.xml"

$xml | Out-File -Encoding UTF8 -FilePath $tempFile


# 프로파일 추가

netsh wlan add profile filename="$tempFile" user

추천0

첨부파일

댓글목록

등록된 댓글이 없습니다.

 

회원로그인

회원가입

WIDEPOWER.COM

접속자집계

오늘
47
어제
228
최대
330
전체
8,314
유틸리티 제대로 배우기
WIDEPOWER
유틸리티 제대로 배우기

Copyright © WIDEPOWER.COM All rights reserved.