[파워쉘]VBS로 파워쉘 실행
# Script/Powershell2017. 3. 5. 18:22[파워쉘]VBS로 파워쉘 실행

ps="powershell.exe -nologo -command " & Chr(34) & "[xxxx.ps1]" & Chr(34) set shell=createobject("WScript.Shell") shell.Run ps,0,true 출처 : http://kernel64.tistory.com/567

[파워쉘]특정날짜 지난 폴더(하위폴더 포함) 삭제
# Script/Powershell2016. 12. 21. 14:28[파워쉘]특정날짜 지난 폴더(하위폴더 포함) 삭제

1. 현재날짜보다 3일이전 날짜를 변수로 저장 $deleteday = (get-date).adddays(-3).tostring("yyyyMMdd") 2. 정리할 폴더 위치를 변수 저장 $deletedir = "C:\templog" 3. 현재 날짜를 기준으로 지정된 날짜 전에 폴더를 삭제 get-childitem -path $deletedir| where-object {$_.name -le $deleteday} | remove-item -recurse -force 단, 파일명이 길경우는 위와 같이 진행시 오류가 발생합니다 ㅜ_ㅜ 4. delete_folder.ps1파일로 저장 $del_dir = get-childitem -path $deletedir| where-object {$_.name -le $del..

[파워쉘]파일내 특정문자열 치환
# Script/Powershell2016. 3. 15. 13:20[파워쉘]파일내 특정문자열 치환

파워쉘을 이용한 파일내 치환방법은 아래와 같습니다. get-content 대상파일 | %{$_ -replace ('기존내용','변경할 내용')} 지정된 파일내에 특정문자를 치환하지만 실제로 파일에 저장되진 않습니다. 변수명 =get-content 대상파일 | %{$_ -replace ('기존내용','변경할 내용')} 변수명 > 대상파일 실행파일 명령어를 변수로 저장하여 리다이렉션시키면 치환했던 내용으로 저장할수가 있습니다.

[파워쉘]IIS웹사이트 추출
# Script/Powershell2016. 2. 24. 09:25[파워쉘]IIS웹사이트 추출

# get-website | export-csv C:\my_list.csv 출처 : http://stackoverflow.com/questions/13126811/powershell-list-of-websites-using-get-website 참고1 : https://technet.microsoft.com/en-us/library/hh867835(v=wps.630).aspx 참고2 : http://vstarmanv.tistory.com/102

[파워쉘]로컬계정 활성화 및 비활성화
# Script/Powershell2016. 1. 5. 16:50[파워쉘]로컬계정 활성화 및 비활성화

EnableDisableUser.ps1 param($computer="localhost", $a, $user, $password, $help) function funHelp() { $helpText=@" DESCRIPTION: NAME: EnableDisableUser.ps1 Enables or Disables a local user on either a local or remote machine. PARAMETERS: -computer Specifies the name of the computer upon which to run the script -a(ction) Action to perform -user Name of user to create -help p..

image