Skip to main content

Use PowerShell to Determine when Services are Loaded

It is another 100+ day here in Phoenix, but that is OK.  I’m spending the day catching up on projects.  In particular, I’m enhancing my Windows 10 classes.  I’m working on creating a better presentation on the Windows 10 boot sequence and I thought that I would share my code with you. 

Value
Meaning
0
Boot (loaded by kernel loader). Components of the driver stack for the boot (startup) volume must be loaded by the kernel loader.
1
System (loaded by I/O subsystem). Specifies that the driver is loaded at kernel initialization.
2
Automatic (loaded by Service Control Manager). Specifies that the service is loaded or started automatically.
3
Manual. Specifies that the service does not start until the user starts it manually, such as by using Device Manager.
4
Disabled. Specifies that the service should not be started.

These are the start values for services on your client.  For example, if you wanted to know which services started at boot, try this:

Get-ChildItem -Path HKLM:\System\CurrentControlSet\Services |
        ForEach-Object -Process {
            $Name = $_.Name.Replace('HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\',$Null)
            Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\$Name" } |
        Where-Object Start -eq 0 |
        Select-Object -Property PSChildName


Yes, I know. It is a bit ugly.  It works though.  Change the Where-Object filter so you can see when/how services are loaded into memory.  

Comments

Popular posts from this blog

How to list all the AD LDS instances on a server

AD LDS allows you to provide directory services to applications that are free of the confines of Active Directory.  To list all the AD LDS instances on a server, follow this procedure: Log into the server in question Open a command prompt. Type dsdbutil and press Enter Type List Instances and press Enter . You will receive a list of the instance name, both the LDAP and SSL port numbers, the location of the database, and its status.

How to run GPResult on a remote client with PowerShell

In the past, to run the GPResult command, you would need to either physically visit this client, have the user do it, or use and RDP connection.  In all cases, this will disrupt the user.  First, you need PowerShell remoting enabled on the target machine.  You can do this via Group Policy . Open PowerShell and type this command. Invoke-Command –ScriptBlock {GPResult /r} –ComputerName <ComputerName> Replace <ComputerName> with the name of the target.  Remember, the target needs to be online and accessible to you.

Error icon when creating a GPO Preference drive map

You may not have an error at all.  Take a look at the drive mapping below. The red triangle is what threw us off.  It is not an error.  It is simply a color representation of the Replace option of the Action field in the properties of the drive mappings. Create action This give you a green triangle. The Create action creates a new mapped drive for users. Replace Action The Replace action gives you a red triangle.  This action will delete and recreate mapped drives for users. The net result of the Replace action is to overwrite all existing settings associated with the mapped drive. If the drive mapping does not exist, then the Replace action creates a new drive mapping. Update Action The Update action will have a yellow triangle. Update will modify settings of an existing mapped drive for users. This action differs from Replace in that it only updates settings defined within the preference item. All other settings remain as configured on the mapped drive. If the