Connect-VIServer

$ResourcePool = "hostname"
Get-VMHost -Name $ResourcePool | Get-VM | 
Where-Object{$_.ExtensionData.Runtime.ConnectionState -eq "orphaned"} | 
ForEach-Object -Process {
  Remove-VM -VM $_.Name -Confirm:$false
  New-VM -Name $_.Name -VMHost $_.VMHost -VMFilePath $_.ExtensionData.Summary.Config.VmPathName -Confirm:$false
}

Disconnect-VIServer -Server $vCenter -Force -Confirm:$false

 

Orphaned VM 찾아서 재등록 하는 스크립트 고객님이 찾아달라고 해서 찾아오기는 했는데

갑자기 눈앞에 닥친 업무가 쏟아져서 고객도 까먹고 나도 까먹는 바람에 테스트는 못해봤음...

 

 

반응형
Get-ChildItem -Recurse -Exclude "CS1*" | Rename-Item -NewName {"CS1_" + $_.Name}

 

 

 

내가 밥벌어먹고 살고 있는 솔루션은

동기화 하고 있는 여러대의 서버가 전부 같은 날짜로 각자의 로컬 디스크에 로그를 쌓는다. 

 

평소에는 로그 볼 일이 많지 않은데

슬프게도 이 명령어를 주로 사용할 때는 장애 발생했을 때다.

 

나중에 로그를 찾을 때 이게 몇번 서버에서 나온 녀석인지 무쟈게 헷갈리기 때문에

어느 서버 출신인지 파일명에 박아두니 보기가 조금 수월해진다. 

 

반응형
#Read-Host -AsSecureString | ConvertFrom-SecureString | Out-File C:\test\secure.dat

$DomainName = "Domain Name"
$OUpath = "OU=TargetOU,DC=TargetDC,DC=com"
$Username = "DomainJoinAccount"

$PW = Get-Content C:\test\Secure.dat
$SecurePW = ConvertTo-SecureString $PW
$Credential = New-Object System.Management.Automation.PSCredential($Username,$SecurePW)

Add-Computer -DomainName $DomainName -OUPath $OUpath -Credential $Credential

shutdown /s /t 60

Remove-Item C:\test\secure.dat
Remove-Item C:\Temp\DomainJoin.ps1

 

 

반응형

Windows 용 모듈을 Mac에 설치하는게 웃기기는 하지만 이게 업이라...

 

우선 Homebrew를 사용해서 Powershell 먼저 설치..

 

https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos?view=powershell-7.1 

 

Installing PowerShell on macOS - PowerShell

Information about installing PowerShell on macOS

learn.microsoft.com

 

이건 공식 문서가 너무 잘나와서 딱히 내가 보탤 말이 없다. 

 

그 다음에 VMware PowerCLI 설치인데 

 

https://github.com/vmware/PowerCLI-Example-Scripts

 

GitHub - vmware/PowerCLI-Example-Scripts

Contribute to vmware/PowerCLI-Example-Scripts development by creating an account on GitHub.

github.com

 

 

 

 

GitHub에서 VMware PowerCLI 모듈을 몽땅 다운 받은 후

 

Terminal 실행 - Powershell을 구동하기 위해 pwsh 입력

 

$env:PSModulePath 를 입력하면 모듈이 설치되는 위치가 나온다. 

 

다운로드한 파일 압축 풀어서 해당 경로에 mv로 넣으면 모듈 준비 완료.

 

Import-Module VMware.VimAutomation.Core

Import-Module VMware.VimAutomation.HorizonView

Import-Module VMware.Hv.Helper

 

등 모듈 Import 후 Connect-VIserver, Connect-HVServer 등의 명령어가 호출되면 정상 로딩 완료. 

 

 

반응형

https://kb.vmware.com/s/article/2006292

 

vdmadmin -N -domains -exclude -domain <domain.co.kr> -remove

 

고객사에 새로 설치한 Horizon Connection Server Admin console 로그인 페이지에

도메인이 2개로 보이는 현상 발생. 

 

아마도 AD에서 같은 포레스트 안에 있는 도메인 2개를 모두 당겨온 듯 했다. 

 

Console GUI와 ADSI 편집기를 뒤져봤으나 거기서는 못찾았고..

vdmadmin으로 제외 가능... 한데 

이런건 UI로 해줘도 괜찮을텐데 싶은 아쉬움. 

 

Note: You can also set the HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware VDM\RecursiveDomainEnum registry key that controls recursive domain enumeration to false. This disables recursive domain searching.
 If you are adding a domain to the Include list, ensure it is not present in Exclude list and Search list. If it is present, please remove it from both Exclude list and Search list.

 

이 노트를 봐서는 레지스트리 설정으로도 가능할 것 같기는 한데... vdmadmin으로 깔끔하게 끝나서 굳이 레지스트리로는 테스트하지 않았음. 

반응형

https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Horizon-Connection-Server-requires-static-IP/td-p/2869972

 

Broadcom Community - VMTN, Mainframe, Symantec, Carbon Black

 

community.broadcom.com

 

 

<installer.exe> /v VDM_STATIC_IP_CHECK=0

 

이걸로 된다는데 과연 실서비스용 서버를 DHCP로 쓰는 곳이 있으려나...?

반응형
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters]
"PollingIterations"=dword:00002ee0
"PollingIterationsMaximum"=dword:00002ee0
"ResendIterations"=dword:00000003
"LayerDriver JPN"="kbd101.dll"
"LayerDriver KOR"="kbd101c.dll"
"OverrideKeyboardType"=dword:00000008
"OverrideKeyboardSubtype"=dword:00000005
"OverrideKeyboardIdentifier"="kbd101c.dll"
"KeyboardFailedReset"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,\
                   00,00,00,00,\
                   03,00,00,00,\
                   72,00,38,E0,\
                   71,00,1D,E0,\
                   00,00,00,00

한영키.reg
0.00MB

 

 

 

맥에서 윈도우로 원격 접속을 많이 하다 보니 

한영 전환이 문제가 될 때가 있어

기존 한/영키를 그대로 사용하면서

Shift + Space bar 조합을 동시에 사용할 수 있는 레지스트리. 

 

 

반응형

Windows의 시작버튼을 눌렀을 때 나오는 단축키 레이아웃이 7시절에는 편집 배포가 참 편했었는데

자꾸 뭐가 늘어나서 점점 흉악하게 바뀌고 있다.

 

이제는 파일로 관리를 해야하니 원..

그나마 편하게 하는 방법은 

마스터 이미지에서 레이아웃 만든 다음 Export - Import 하는 정도...

 

https://winpeguy.wordpress.com/2015/10/30/win10-start-customization-with-layoutmodification-xml/

 

Win10: Start Customization with LayoutModification.xml

So I have made a first pass at configuring the Start (Bar? Window? Screen?).  Once thing to note is that while I made the proper configuration in my LayoutModification.xml with Internet Explorer, f…

winpeguy.wordpress.com

 

 

 

Export-StartLayout -Path C:\Windows\OSConfig\LayoutModification.xml

 

Import-StartLayout -LayoutPath C:\Windows\OSConfig\LayoutModification.xml -MountPath $env:SystemDrive\

 

Or you could just copy your LayoutModification.xml to C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\LayoutModification.xml using the method of your choice.  Changes will affect new User Profiles created after making the change.

 

안타깝게도 작업표시줄은 Export가 안되는 것 같다.. https://docs.microsoft.com/en-us/windows/configuration/configure-windows-10-taskbar

 

Configure the Windows Taskbar Using Policy Settings

Learn how to configure the Windows taskbar to provide quick access to the tools and applications that users need most.

learn.microsoft.com

 

 

<?xml version="1.0" encoding="utf-8"?>
<LayoutModificationTemplate
    xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
    xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
    xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
    xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
    Version="1">
  <CustomTaskbarLayoutCollection>
    <defaultlayout:TaskbarLayout>
      <taskbar:TaskbarPinList>
        <taskbar:UWA AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />
        <taskbar:DesktopApp DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\File Explorer.lnk" />
      </taskbar:TaskbarPinList>
    </defaultlayout:TaskbarLayout>
 </CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>

 

이 귀찮은 xml로 App ID나 경로를 다 쳐서 꾸역꾸역 xml에 합쳐야하나보다.. -_-

일해라 MS...

반응형

http://www.nirsoft.net/utils/multiple_ping_tool.html

 

Ping to multiple host names/IP addresses on Windows 10/8/7/Vista

PingInfoView is a tool for Windows that allows you to easily ping multiple hosts (ICMP Ping or TCP Ping), and watch the result in one table.

www.nirsoft.net

 

 

세상에는 이런 천사 같은 분이 계셔서 살만하다...

 

Multi Ping 본연의 기능에 매우 충실

극도로 쉬운 사용법

자동 Export 는 살짝 찾느라 애먹었는데 Advanced Option(F9)에서 지원

 

개발자님 사랑해요

반응형
function Get-FolderSize {
[CmdletBinding()]
Param (
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
$Path
)
if ( (Test-Path $Path) -and (Get-Item $Path).PSIsContainer ) {
$Measure = Get-ChildItem $Path -Recurse -Force -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum
$Sum = '{0:N2}' -f ($Measure.Sum / 1Gb)
[PSCustomObject]@{
"Path" = $Path
"Size($Gb)" = $Sum
}
}
}

#To use the function, simply run the command with the folder path as an argument:

Get-FolderSize ('D:\')

폴더 크기 계산하는 Powershell 스크립트.

 

TreeSizeFree 같은 훨씬 편한 툴도 있지만 

외부 프로그램 반입에 민감한 사이트도 있고..

가끔은 일점검 같은 형식으로 데이터를 떨궈야 하는 사이트도 있어서

일단 인터넷 뒤져서 선구자님께서 만든 스크립트 줍줍.

 

들여쓰기를 안해뒀지만 테스트해보니 잘 돌아서 굳이 수정은 안하는 걸로...

 

http://woshub.com/powershell-get-folder-sizes/

 

PowerShell: Get Folder Size on Windows | Windows OS Hub

You can use PowerShell to calculate the exact size of a specific folder in Windows (recursively, including all subfolders). This way you can quickly find out the size of the…

woshub.com

 

 

반응형

'Computer > Windows' 카테고리의 다른 글

Windows 10 LayoutModification.xml 파일을 통한 레이아웃 설정  (0) 2025.02.05
Windows 용 Multi Ping tool  (0) 2025.02.04
Windows - IP v6 Disable Registry  (0) 2025.02.04
Windows Machine SID 조회  (0) 2025.01.24
Delete Partition  (0) 2025.01.24

+ Recent posts