Powershell ½ºÅ©¸³Æ® ÄÄ¿¡ µû¶ó¼­ ½ÇÇà °á°ú°¡ ´Ù¸¨´Ï´Ù

dateno1   
   Á¶È¸ 2510   Ãßõ 0    

 #-----------------------------Get Administrator Right-----------------------------
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))  
{  
  $arguments = "& '" +$myinvocation.mycommand.definition + "'"
  Start-Process powershell -Verb runAs -ArgumentList $arguments
  Break
}

#-----------------------------Registry-----------------------------
#Check old temp file exist&delete it
$FileName = "$ENV:tmp\reg_tmp.reg"
if (Test-Path $FileName) {
  Remove-Item $FileName
}

#Create registry file
echo "Windows Registry Editor Version 5.00"`n > $ENV:tmp\reg_tmp.reg
echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\{1FD49718-1D00-4B19-AF5F-070AF6D5D54C}]" >> $ENV:tmp\reg_tmp.reg
echo `"NoExplorer`"=`"0`" >> $ENV:tmp\reg_tmp.reg
echo `"NoInternetExplorer`"=`"1`"`n >> $ENV:tmp\reg_tmp.reg
echo "[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\{1FD49718-1D00-4B19-AF5F-070AF6D5D54C}]" >> $ENV:tmp\reg_tmp.reg
echo `"NoExplorer`"=`"0`" >> $ENV:tmp\reg_tmp.reg
echo `"NoInternetExplorer`"=`"1`"`n >> $ENV:tmp\reg_tmp.reg
echo "[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Edge\IEToEdge]" >> $ENV:tmp\reg_tmp.reg
echo `"RedirectionMode`"=dword:00000000`n >> $ENV:tmp\reg_tmp.reg
echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Edge\IEToEdge]" >> $ENV:tmp\reg_tmp.reg
echo `"RedirectionMode`"=dword:00000000`n >> $ENV:tmp\reg_tmp.reg
echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Ext\CLSID]" >> $ENV:tmp\reg_tmp.reg
echo `"`{1FD49718-1D00-4B19-AF5F-070AF6D5D54C`}`"=`"0`"`n >> $ENV:tmp\reg_tmp.reg

echo "[-HKEY_CLASSES_ROOT\CLSID\`{1FD49718-1D00-4B19-AF5F-070AF6D5D54C`}]" >> $ENV:tmp\reg_tmp.reg
echo "[-HKEY_CLASSES_ROOT\WOW6432Node\CLSID\`{1FD49718-1D00-4B19-AF5F-070AF6D5D54C`}]" >> $ENV:tmp\reg_tmp.reg
echo "[-HKEY_CLASSES_ROOT\ie_to_edge_bho.IEToEdgeBHO]" >> $ENV:tmp\reg_tmp.reg
echo "[-HKEY_CLASSES_ROOT\ie_to_edge_bho.IEToEdgeBHO.1]" >> $ENV:tmp\reg_tmp.reg
echo "[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Extensible Cache\IEToEdgeList]" >> $ENV:tmp\reg_tmp.reg
echo "[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\LowCache\Extensible Cache\IEToEdgeList]" >> $ENV:tmp\reg_tmp.reg
echo "[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\`{1FD49718-1D00-4B19-AF5F-070AF6D5D54C`}]" >> $ENV:tmp\reg_tmp.reg
echo "[-HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\`{1FD49718-1D00-4B19-AF5F-070AF6D5D54C`}]" >> $ENV:tmp\reg_tmp.reg
echo "[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Low Rights\ElevationPolicy\`{c9abcf16-8dc2-4a95-bae3-24fd98f2ed29`}]" >> $ENV:tmp\reg_tmp.reg
echo "[-HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Low Rights\ElevationPolicy\`{c9abcf16-8dc2-4a95-bae3-24fd98f2ed29`}]" >> $ENV:tmp\reg_tmp.reg
echo "[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Ext\Settings\`{1FD49718-1D00-4B19-AF5F-070AF6D5D54C`}]" >> $ENV:tmp\reg_tmp.reg
echo "[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Ext\Stats\`{1FD49718-1D00-4B19-AF5F-070AF6D5D54C`}]" >> $ENV:tmp\reg_tmp.reg
echo "[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ext\PreApproved\`{1FD49718-1D00-4B19-AF5F-070AF6D5D54C`}]" >> $ENV:tmp\reg_tmp.reg
echo "[-HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Ext\PreApproved\`{1FD49718-1D00-4B19-AF5F-070AF6D5D54C`}]" >> $ENV:tmp\reg_tmp.reg
echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Ext\CLSID]" >> $ENV:tmp\reg_tmp.reg
echo `"`{1FD49718-1D00-4B19-AF5F-070AF6D5D54C`}`"=-`n >> $ENV:tmp\reg_tmp.reg

#Apply registry file&Delete it
regedit /s $ENV:tmp\reg_tmp.reg
Remove-Item $FileName

#-----------------------------Files-----------------------------
if ( Test-Path -Path 'C:\Program Files (x86)\Microsoft\Edge' -PathType Container ) { del "C:\Program Files (x86)\Microsoft\Edge\Application\*\bho\*.*" }
if ( Test-Path -Path 'C:\Program Files\Microsoft\Edge' -PathType Container ) { del "C:\Program Files\Microsoft\Edge\Application\*\bho\*.*" }

스크립트 내용물은 위에 적힌대로입니다


물른 적용전

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]
"ExecutionPolicy"="Unrestricted"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\ScriptedDiagnostics]
"ExecutionPolicy"="Unrestricted"

로 고쳐서 이런 부분 문제 아닙니다


컴에 따라서 위 레지 부분의 적용이 안 됩니다 (파일 부분의 처리는 정상)


둘 다 동일한 10 21TH2이므로 버전 차이도 아닌데 결과물에서 차이가 나네요


안 되는 컴에서도 하단의 파일 레지 파일 삭제 제거하고 실행해서 생성된 레지 파일 보면 내용물 정상입니다 (%tmp% 작동하는것 보면 환경 변수 정상)


맨날 삽질만 하고 삽니다

http://www.2cpu.co.kr/hardware_2014/44147
컴 케이스 작다고 불타거나 하지 않아요

ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
ȲÁø¿ì 2021-09
´å³Ý¹öÀüÂ÷ÀÌ°¡ ¾Æ´Ò±î¿ä?..
     
dateno1 2021-09
µ¿ÀÏÇÑ 21TH2 x64 (óÀ½ºÎÅÍ 4.8·Î °íÁ¤)ÀÔ´Ï´Ù

1´ë¿¡¼­ ÀÛ¾÷ÈÄ ½ÃÇèÇÏ°í, ´Ù¸¥ ÄÄ¿¡¼­ ¶È°°ÀÌ µ¹·Áº¸´Ï ¾È µÇ´Â Ȳ´ç Àü°³³×¿ä

¿ô±â´Â°Ç »ý¼ºµÈ ·¹Áö ÆÄÀÏ ¼öµ¿ ½ÇÇàÇϸé Á¤»ó °á°ú ³ª¿Í¿ä (°á±¹ regedit /s $ENV:tmp\reg_tmp.reg°¡ ¾È µÊ)

´õ Ȳ´çÇÑ°Ç ÆÄ¿ö¼¿ ¿¬´ÙÀ½ ¼öµ¿À¸·Î Àú°Å C&PÇϸé Á¤»óÀÔ´Ï´Ù (...)
À©µµ¿ì¶ó.. ¿ª½Ã ½Å·Ú¼ºÀÌ ¾ø¾î¼­ ±×·²°Ì´Ï´Ù.
°ü¸®ÀÚ±ÇÇÑ Àоî¿À°í ¹Ù·Î ·¹Áö¿¡ µî·ÏÇϸé¾ÈµÇ³ª¿ä ¿Ö ÆÄÀÏ·Î ¸¸µå½Ã´Â Áö¿ä?
     
dateno1 2021-09
reg ¸í·ÉÀ¸·Î ´Ù µÇ´Âµ¥, óÀ½¿¡ ·¹Áö·Î ¶§¿ì´ø°É °£´ÜÇÏ°Ô º¯È¯ÇÏ´À¶ó Àú·¸°Ô ‹š¿î°Ì´Ï´Ù (±ÍÂú¾ÒÀ½)
¹«¾Æ 2021-09
µÎ ÄÄÀÇ »ç¿ëÀÚ ±ÇÇÑ ¼³Á¤ÀÌ ´Ù¸¥ °Ç ¾Æ´Ò±î¿ä?
¾Æ´Ï¸é µÎ »ç¿ëÀÚ È¯°æº¯¼ö ¼³Á¤ÀÌ ´Ù¸£µçÁö..
     
dateno1 2021-09
µÑ ´Ù OS ¼³Ä¡½Ã ÀÔ·ÂÇÑ ÃÖÃÊÀÇ °èÁ¤ÀÔ´Ï´Ù (µÑ ´Ù Á÷Á¢ OS ¼³Ä¡ÇßÀ¸´Ï È®½Ç)

ȯ°æ º¯¼ö ¹®Á¦¸é ÆÄ¿ö¼¿¿¡ ¼öµ¿À¸·Î C&PÇßÀ»¶§ ¾È µÇ¾î¾ßÇϴµ¥, ¼öµ¿Àº µÇ¿ä (¿ô±â°Ô ½ºÅ©¸³Æ®·Î ÀÚµ¿À¸·Î ÇÒ¶§¸¸ ¾È µÊ) (¶ö±î Àú°Å À©µµ ±âº»À¸·Î »ý¼ºµÇ´Â º¯¼ö)
Á¤ÀǼ® 2021-09
regedit /s $ENV:tmp\reg_tmp.reg
ÀÌ ºÎºÐÀ» ÆÄ¿ù½©¿¡¼­ Á÷Á¢ ÀÔ·ÂÇؼ­ ½ÇÇàÇÏ¸é µÈ´Ù´Â ¸»¾¸À̽ÃÁÒ?
±×·¯¸é ½ºÅ©¸³Æ®¿¡¼­ ´Ù¸¥ºÎºÐÀº ´Ù Áö¿ì°í Àú ºÎºÐ¸¸ ³Ö¾î¼­ ½ÇÇàÇÏ¸é ¾î¶»°Ô µÇ´ÂÁö¿ä?
Ȥ½Ã ¾ÈµÈ´Ù¸é,, $ENV:tmp ºÎºÐÀ» Àý´ë°æ·Î·Î ÇÏ¸é ¾î¶»°Ô µÇ´ÂÁö¿ä?


QnA
Á¦¸ñPage 1550/5687
2014-05   4994194   Á¤ÀºÁØ1
2015-12   1530128   ¹é¸Þ°¡
2012-09   9036   HEUo±è¿ë¹Î
2016-10   6067   ¾Æ³¯·Î±×
2009-07   6153   ÀϹÝÀ¯Àú
2012-10   5941   ¹Ì¼ö¸Ç
2020-04   2129   ÁÖȲº°
2012-10   5885   °¡ºü·Î±¸³ª
2017-11   3506   KindOfBlue
2014-07   4318   »ïµ¹±º
2021-09   3423   È­ÀÌÆ®³ëÀÌÁî
2012-10   11927   HEUo±è¿ë¹Î
2016-10   4074   °ú°ÅÁö»ç
2021-09   1818   ġŲŸ¿Ã
2021-09   2511   dateno1
2017-12   4212   ³ª¶ó»ç¶û
2009-09   6654   °æ¹ÚÇѽùÎ
2012-11   5622   ºí·ç¸ð¼Ç
2015-11   9043   µÎ¸®¾È
2019-02   3210   osthek83
2012-11   6173   Áø¿äÇÑ
2016-11   4893   Ŭ·¡½Ä