Posts

Showing posts from 2018

BGInfo in startup

Below is the syntax for BGInfo startup file: /timer:0 /nolicprompt /silent Example: C:\BGInfo\Bginfo64.exe C:\BGInfo\BGInfo.bgi /timer:0 /nolicprompt /silent Create a shortcut with Target containing above and place the shortcut in: shell:startup

Ways to execute PowerShell (PS1) scripts in remote computers

Below are ways to execute PowerShell (PS1) scripts in remote computers: Example 1: invoke-command -computerName MySrv1 -filepath .\test.ps1 Example 2: Get the version of the PowerShell host running on a remote computer: invoke-command -computername server64 -scriptblock {(get-host).version} Example 3: Get the version of the PowerShell host running on a list of remote computers (computers.txt): PS C:\> $version = invoke-command -computername (get-content computers.txt) -scriptblock {(get-host).version} PS C:\> $version Example 4: Run the Sample.ps1 script on all of the computers listed in the Servers.txt file. Using the -FilePath parameter to specify the script file has the effect that the content of the script is automatically copied into a script block and then passed to and run on each of the remote computers: PS C:\> invoke-command -comp (get-content servers.txt) -filepath c:\scripts\sample.ps1 -argumentlist Process, Service Alternatives method: Inv

TLS versions 1.0, 1.1 and 1.2 in Windows servers

When there is communication issue from client to server due to TLS versions, below values in Registry needs to be checked: Reg values to check for: DisabledByDefault REG_DWORD 1 or 0 Enabled REG_DWORD 1 or 0 Reg paths: TLS 1.0 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server TLS 1.1 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server TLS 1.2 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server Clients may need this update for compatible TLS versions: https://support.microsoft.com/en-sg/help/3080079/up

PowerCLI commands to manage VMs

PowerCLI - Get-Member - Get all properties of an object To Open VM Console: Get-VM VMName | Open-VMConsoleWindow To get VM Properterties : Get-VM | Get-Member -MemberType property | Format-Table -Property Name To set browser for VM Console: Set-PowerCLIConfiguration –VMConsoleWindowBrowser “C:\Program Files ( x86 ) \Mozilla Firefox\ firefox.exe ” #To set the browser Set-PowerCLIConfiguration –VMConsoleWindowBrowser “ $ null ” #To clear above setting Get-HardDisk -VM Output like this: CapacityGB Persistence Filename Appendix - Command outputs: Output: Name ---- CDDrives CustomFields DatastoreIdList Description DrsAutomationLevel ExtensionData FloppyDrives Folder FolderId Guest HAIsolationResponse HardDisks HARestartPriority Host HostId Id MemoryMB Name NetworkAdapters Notes NumCpu PersistentId PowerState ProvisionedSpaceGB ResourcePool ResourcePoolId Uid UsbDevices UsedSpaceGB VApp Version VMHost VMHostId VMResourceConfiguration VMSwapfilePolicy I

[Windows][Commands] Get DNS servers of a domain

Ways to get DNS servers of a domain: Method 1: nslookup > set type=NS > Outputs: Non-authoritative answer:   nameserver = DNSserverNamel   nameserver = DNSserverName2 DNSserverNamel     internet address = DNSserverIPl DNSserverName2    internet address = DNSserverIP2 Method 2: nltest /dnsgetdc: Output: List of DCs in pseudo-random order taking into account SRV priorities and weights: Non-Site specific:    DNSserverNamel  DNSserverIPl    DNSserverName2  DNSserverIP2 The command completed successfully.

Corrupted Windows driver store - solution

\Windows\System32\DriverStore\FileRepository Verify driverstore is good by either method: By using command pnputil -e By using DriverStoreExplorer https://github.com/lostindark/DriverStoreExplorer/releases/tag/v0.9.10 Bad example: C:\>pnputil -e Microsoft PnP Utility Enumeration of driver packages failed :The request is not supported. No published driver packages were found on the system. Good example: C:\Users\jdevasah>pnputil -e Microsoft PnP Utility Published name :            oem0.inf Driver package provider :   Microsoft Class :                     Printers Driver date and version :   06/21/2006 6.1.7600.16385 Signer name :               Microsoft Windows Published name :            oem1.inf Driver package provider :   Microsoft Class :                     Printers Driver date and version :   06/21/2006 6.1.7601.17514 Signer name :               Microsoft Windows Published name :            oem2.inf Driver package provide

MS OFFICE scrub scripts

Troubleshooting Windows Activation issues with KMS

Troubleshooting Windows Activation issues with KMS nslookup -type=all  _vlmcs._tcp Shows KMS servers in the domain. slmgr.vbs /dlv should show you if the client is referencing a KMS host, look for KMS REGISTERED MACHINE NAME: servername:1688 In order to use KMS.. the client needs to be using KMS licensing.. so the key you enter on install should be a KMS key, and not a MAK key. Commands: slmgr.vbs -upk - to uninstall any existing product key (if any) slmgr.vbs -ipk   KMS product key   - To enter the KMS key slmgr.vbs /skms :1688 - to point to a static KMS server if any slmgr.vbs /ckms - to auto-discover KMS servers slmgr.vbs /ato - to activate the KMS license key slmgr.vbs /rearm - to extend the license to 60 days (max 3 times up to 180 days) slmgr.vbs /skms dcpwav22179985:1688 Application event logs to check for activation attempts: 12288,12289 Reg key: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform KeyManagementSe