Saturday, June 20, 2020

How to delete mount drive in windows 10 and server from Power Shell



Run below command in power-shell

1. Check the Mount folder permission and if don't have full access then give full access to user.




2.  Redirect the power-shell console to mount folder and close open mount folder.
        
    Ex -   CD C:\Setup\Mount

3.  Run Command:  Dism /cleanup-wim



4.   Now you see mount folder is empty and you can easily shift and delete the mount folder.

5.   Some case you need to reboot the machine.

Thursday, June 11, 2020

My Review on "Hydration Kit For Windows Server 2016 and ConfigMgr Current" is 5 ***** 😊

 
Johan Arwidmark has created Hydration Kit for creating a SCCM LAB.This automation magic tool kit completely reduce your manual effort and gives you standard lab environment in minimum 3 hours.If you are SCCM admin and want to create a lab so i will suggest use below link.
 
Link is:


What some conman mistake we do when we follow the the lab instructions and it lead to stupid errors.I am just discussing some mistakes i did .Which can be help some one..

1.    Create WIM file carefully use latest patch with 3.5 .net frame work.

2.    In case you get below error prompt after running DC01 and CM01 task sequence so please refer below Johan Arwidmark blog  for resolution.
 
Error : Failed to save environment to (80070057)




3.  Error on CM01 "extadsch.exe mfc120.dll missing".(May be Redistributable not installed or got corrupt ) 

          


You need to install Visual C++ Redistributable for Visual Studio 2015 x64 and x86 both in task sequence before config manager prerequisites or this you can download and install during the task sequence is running.

4.  While creatinga deployment share  if you get WARNING: MDT 8456 not installed, aborting...
in power shell script and you already installed MDT but still you are facing the issue .It means version miss match.You can comment this line or match the exact version you have install.
 
5.  Keep running DC01 once you are creating CM01 task sequence .





Wednesday, June 3, 2020

IMP - WMI & Powershell Commands


Remote session using Psexec 

PSEXEC \\hostname -s -h -d powershell.exe "enable-psremoting" -force

For enabling the PS session for remote machine

Enter-PSSession -ComputerName RDP-xxxxxx-VSB
Enable-PSRemoting -Force
winrm quickconfig    #### Enable remote service

Wmi Query : Run Command on power shell console for system info

Get-WmiObject -List
wmic CSProduct list
wmic CSproduct get model
wmic CSproduct get version
Wmic os list brief

Get-WmiObject -Class Win32_OperatingSystem
WMIC COMPUTERSYSTEM GET /?
Install-Module PSWindowsUpdate -force
Get-wmiobject win32_computersystem -computer $_ | select-object systemtype
(Get-WmiObject Win32_OperatingSystem).OSArchitecture

Nomad client:

C:\Program Files\1E>nomadbranch.exe>  /relicense=XXX-XXXX-XXXX-XXXX
CacheCleaner.exe -deletepkg=cp100372 -pkgver=19    
Get-Service -Name NomadBranch -ComputerName CHE-DAA0218-01 | Restart-Service
C:\Program Files\1E\NomadBranch>CacheCleaner.exe -MaxcacheAge=30 
Pending reboot machine

SCCM Client And Sys Registry:

Get-WmiObject -Namespace root\ccm -Class * -List
Get-WmiObject -namespace root\ccm -class sms_client -computername RDP-cxy0801-vsb
Get-WmiObject -Namespace root\ccm -Class SMS_Client
Get-WmiObject -Query "SELECT * from Win32_bios"
Get-WmiObject -List
GET install product 
Get-WmiObject -Class Win32_Product -ComputerName RDP-   XXXX-vsb
Get-WmiObject -Class Win32_product -ComputerName RDP-CXY0801-VSB | Where {$_.Name -match 'SQL' }
Get-WmiObject win32_product | where {$_.Name -match 'office'} | select name, version
Get-WmiObject win32_product -ComputerName RDP-CXY0801-VSB | where {$_.Name -match 'office'} | select name, version

Invoke-command -computer BLR-P-CMSS01 {Get-ItemProperty HKLM:\Software\1E\NomadBranch\ | select SpecialNetShare,SigsFolder}

Invoke-WMIMethod -ComputerName RDP-CXY0801-V76 -Namespace root\ccm -Class SMS_CLIENT -Name TriggerSchedule "{00000000-0000-0000-0000-000000000108}"

Get-ItemProperty -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select DisplayName,version
 
Delete Reg:

Invoke-Command -ComputerName xxx-xxx-xxx -ScriptBlock {Remove-Item -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{083988D7-BDA9-4244-983B-409A634BBC09}' -Confirm:$false}

WindowsVersion:

Invoke-command -computer BLA-BXK0815-1 {(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseId}  

System Info:

wmic computersystem get model,name,manufacturer,systemtype

GET OU detail:

Get-ADComputer -Filter "Name -like 'BLR-CXY0801*'"
Invoke-CimMethod -Namespace root/ccm/ClientSDK -ClassName CCM_ClientUtilities -MethodName DetermineIfRebootPending

Get WMI classes:

Get-CimClass
Get-CimClass -ClassName win32*
Get-CimClass -ClassName win32* | where CimClassMethods -ne $null  | select CimClassName,CimClassMethods

Get-WmiObject -Query 'Select * From Meta_Class WHERE __Class LIKE "win32%"' | Where-Object { $_.PSBase.Methods } | Select-Object Name, Methods

Get-WmiObject -List | Where { $_.name -match 'User'}
gwmi win32_product -Filter "Name like 'google%'"  | ft name, version, ident*,vendor,caption

Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object {$_.DisplayName -match 'amazon'} | Select-Object -Property DisplayName,DisplayVersion,UninstallString,Publisher | FT

Invoke Command:

Get-ItemProperty -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select DisplayName,version

Set-ItemProperty -Path hklm:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Ext\CLSID -Name '{B3A6DA95-9243-48E9-AF2E-52F4FF155B9D}' -Value 1 -Type STRING

Invoke-Command -cn wfe0,wfe1 -ScriptBlock {Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | select DisplayName, Publisher, InstallDate