Powershell Commands

a list of useful commands for powershell


Find the path of an executable

(get-command python).path

$ip="192.168.1.XXX" $svc_name="Spooler"

get-service -computername $ip | Where-Object {$.Status -eq "Running"} get-service -computername $ip | Where-Object {$.Name -eq $svc_name}

get-service -computername $ip | Where-Object {$_.Name -eq $svc_name} | Stop-Service -PassThru | Set-Service -StartupType Disabled

get-service | Where-Object {$_.Status -eq "Running"}

$services = @("WSearch", "XboxGipSvc","XblAuthManager","XblGameSave","XboxNetApiSvc") foreach ($service in $services) { get-service | Where-Object {$_.Name -eq $service} }

foreach ($service in $services) { get-service | Where-Object {$_.Name -eq $service} | Stop-Service -PassThru | Set-Service -StartupType Disabled }

List Installed Packages

Get-Package

Get-Package | select name

$winapps=@( "Microsoft OneDrive", "Microsoft Edge" ) foreach ($winapp in $winapps){ Get-Package -Name "$winapp" | Uninstall-Package }

ps onedrive | Stop-Process -Force cd "$env:windir\SysWOW64\"
OneDriveSetup.exe /uninstall

Get-AppxPackage | select Name,NonRemovable,PackageUserInformation,PackageFullName

Get-AppxPackage | Where-Object NonRemovable -EQ 0 | select Name

$winapps=@("Microsoft.BingNews", "Microsoft.XboxSpeechToTextOverlay", "MicrosoftCorporationII.QuickAssist", "MSTeams", "Microsoft.OutlookForWindows", "Microsoft.Paint", "Microsoft.MicrosoftStickyNotes", "Microsoft.Copilot", "Microsoft.XboxIdentityProvider", "Clipchamp.Clipchamp", "Microsoft.Xbox.TCUI", "Microsoft.BingWeather", "Microsoft.Todos", "MicrosoftCorporationII.MicrosoftFamily", "Microsoft.GamingApp", "Microsoft.MicrosoftSolitaireCollection", "Microsoft.GetHelp", "Microsoft.YourPhone", "Microsoft.WebpImageExtension", "Microsoft.XboxGamingOverlay", "Microsoft.HEIFImageExtension", "Microsoft.WindowsSoundRecorder", "Microsoft.AV1VideoExtension", "Microsoft.HEVCVideoExtension", "Microsoft.MPEG2VideoExtension", "Microsoft.BingSearch", "Microsoft.StartExperiencesApp", "Microsoft.WindowsNotepad", "Microsoft.StorePurchaseApp", "Microsoft.WindowsCalculator", "Microsoft.ZuneMusic", "Microsoft.WindowsAlarms", "Microsoft.WindowsCamera", "Microsoft.MicrosoftEdge.Stable", "Microsoft.WebMediaExtensions", "Microsoft.ScreenSketch", "Microsoft.Windows.Photos", "Microsoft.WindowsFeedbackHub", "Microsoft.MicrosoftOfficeHub", "Microsoft.RawImageExtension", "Microsoft.WindowsStore") foreach ($winapp in $winapps){ Get-AppxPackage $winapp -AllUsers| Remove-AppPackage -AllUsers -verbose }

Get-AppxPackage BingWeather -AllUsers| Remove-AppPackage –AllUsers -verbose Get-AppxPackage copilot -AllUsers| Remove-AppPackage –AllUsers -verbose

Service List

Status Name DisplayName ------ ---- ----------- Running AppIDSvc Application Identity Running Appinfo Application Information Running AppXSvc AppX Deployment Service (AppXSVC) Running AudioEndpointBu... Windows Audio Endpoint Builder Running Audiosrv Windows Audio Running BFE Base Filtering Engine Running BrokerInfrastru... Background Tasks Infrastructure Ser... Running BTAGService Bluetooth Audio Gateway Service Running BthAvctpSvc AVCTP service Running bthserv Bluetooth Support Service Running camsvc Capability Access Manager Service Running cbdhsvc_44158 cbdhsvc_44158 Running CDPSvc Connected Devices Platform Service Running CDPUserSvc_44158 CDPUserSvc_44158 Running CoreMessagingRe... CoreMessaging Running cplspcon Intel(R) Content Protection HDCP Se... Running CryptSvc Cryptographic Services Running DcomLaunch DCOM Server Process Launcher Running DeviceAssociati... Device Association Service Running DevicesFlowUser... DevicesFlowUserSvc_44158 Running Dhcp DHCP Client Running DiagTrack Connected User Experiences and Tele... Running DispBrokerDeskt... Display Policy Service Running Dnscache DNS Client Running DoSvc Delivery Optimization Running DPS Diagnostic Policy Service Running DusmSvc Data Usage Running EventLog Windows Event Log Running EventSystem COM+ Event System Running FontCache Windows Font Cache Service Running gpsvc Group Policy Client Running hidserv Human Interface Device Service Running HvHost HV Host Service Running IKEEXT IKE and AuthIP IPsec Keying Modules Running InstallService Microsoft Store Install Service Running IntelGraphicsSo... Intel® Graphics Software Running InventorySvc Inventory and Compatibility Apprais... Running iphlpsvc IP Helper Running jhi_service Intel(R) Dynamic Application Loader... Running KeyIso CNG Key Isolation Running LanmanServer Server Running LanmanWorkstation Workstation Running lfsvc Geolocation Service Running LicenseManager Windows License Manager Service Running lmhosts TCP/IP NetBIOS Helper Running LSM Local Session Manager Running MDCoreSvc Microsoft Defender Core Service Running mpssvc Windows Defender Firewall Running NcbService Network Connection Broker Running Netbird Netbird Running netprofm Network List Service Running NPSMSvc_44158 NPSMSvc_44158 Running nsi Network Store Interface Service Running PcaSvc Program Compatibility Assistant Ser... Running PlugPlay Plug and Play Running PolicyAgent IPsec Policy Agent Running Power Power Running ProfSvc User Profile Service Running RasMan Remote Access Connection Manager Running RmSvc Radio Management Service Running RpcEptMapper RPC Endpoint Mapper Running RpcSs Remote Procedure Call (RPC) Running RtkBtManServ Realtek Bluetooth Device Manager Se... Running SamSs Security Accounts Manager Running Schedule Task Scheduler Running SecurityHealthS... Windows Security Service Running SENS System Event Notification Service Running ShellHWDetection Shell Hardware Detection Running Spooler Print Spooler Running SSDPSRV SSDP Discovery Running SstpSvc Secure Socket Tunneling Protocol Se... Running StateRepository State Repository Service Running StorSvc Storage Service Running SysMain SysMain Running SystemEventsBroker System Events Broker Running TextInputManage... Text Input Management Service Running Themes Themes Running TimeBrokerSvc Time Broker Running TokenBroker Web Account Manager Running TrkWks Distributed Link Tracking Client Running tvnserver TightVNC Server Running UdkUserSvc_44158 UdkUserSvc_44158 Running UserManager User Manager Running UsoSvc Update Orchestrator Service Running Wcmsvc Windows Connection Manager Running wcncsvc Windows Connect Now - Config Registrar Running WdiSystemHost Diagnostic System Host Running WdNisSvc Microsoft Defender Antivirus Networ... Running webthreatdefuse... webthreatdefusersvc_44158 Running WFDSConMgrSvc Wi-Fi Direct Services Connection Ma... Running whesvc Windows Health and Optimized Experi... Running WinDefend Microsoft Defender Antivirus Service Running WinHttpAutoProx... WinHTTP Web Proxy Auto-Discovery Se... Running Winmgmt Windows Management Instrumentation Running WlanSvc WLAN AutoConfig Running WMIRegistration... Intel(R) Management Engine WMI Prov... Running WpnService Windows Push Notifications System S... Running WpnUserService_... WpnUserService_44158 Running WSAIFabricSvc Windows AI Components Host Running wscsvc Security Center Running WSearch Windows Search Running wuauserv Windows Update

Windows Packages

"Microsoft.BingNews", "Microsoft.XboxSpeechToTextOverlay", "MicrosoftCorporationII.QuickAssist", "MSTeams", "Microsoft.OutlookForWindows", "Microsoft.Paint", "Microsoft.MicrosoftStickyNotes", "Microsoft.Copilot", "Microsoft.XboxIdentityProvider", "Clipchamp.Clipchamp", "Microsoft.Xbox.TCUI", "Microsoft.BingWeather", "Microsoft.Todos", "MicrosoftCorporationII.MicrosoftFamily", "Microsoft.GamingApp", "Microsoft.MicrosoftSolitaireCollection", "Microsoft.GetHelp", "Microsoft.YourPhone", "Microsoft.WebpImageExtension", "Microsoft.XboxGamingOverlay", "Microsoft.HEIFImageExtension", "Microsoft.WindowsSoundRecorder", "Microsoft.AV1VideoExtension", "Microsoft.HEVCVideoExtension", "Microsoft.MPEG2VideoExtension", "Microsoft.BingSearch", "Microsoft.StartExperiencesApp", "Microsoft.WindowsNotepad", "Microsoft.StorePurchaseApp", "Microsoft.WindowsCalculator", "Microsoft.ZuneMusic", "Microsoft.WindowsAlarms", "Microsoft.WindowsCamera", "Microsoft.MicrosoftEdge.Stable", "Microsoft.WebMediaExtensions", "Microsoft.ScreenSketch", "Microsoft.Windows.Photos", "Microsoft.WindowsFeedbackHub", "Microsoft.MicrosoftOfficeHub", "Microsoft.RawImageExtension", "Microsoft.WindowsStore"

About

I am an engineer and educator, having spent ten years as a professor. My goal is to help you build your knowledge of design and technology, get your hardware working, and propel your startup or small business. Get in touch!

Read More