diff --git a/dlls/wmiutils/path.c b/dlls/wmiutils/path.c
index 988d2e635f02716454a7a5c290ed2572927782a8..046f424fe5499043810015c0dcb492c409d5a9f0 100644
--- a/dlls/wmiutils/path.c
+++ b/dlls/wmiutils/path.c
@@ -420,15 +420,18 @@ static HRESULT parse_text( struct path *path, ULONG mode, const WCHAR *text )
         path->flags |= WBEMPATH_INFO_PATH_HAD_SERVER;
     }
     p = q;
-    if (*q && *q != '\\' && *q != '/' && *q != ':')
+    if (strchrW( p, '\\' ) || strchrW( p, '/' ))
     {
-        path->num_namespaces = 1;
-        q++;
-    }
-    while (*q && *q != ':')
-    {
-        if (*q == '\\' || *q == '/') path->num_namespaces++;
-        q++;
+        if (*q != '\\' && *q != '/' && *q != ':')
+        {
+            path->num_namespaces = 1;
+            q++;
+        }
+        while (*q && *q != ':')
+        {
+            if (*q == '\\' || *q == '/') path->num_namespaces++;
+            q++;
+        }
     }
     if (path->num_namespaces)
     {
diff --git a/dlls/wmiutils/tests/path.c b/dlls/wmiutils/tests/path.c
index 54c0e9a239b8287890b6dcd72f8d77f2a13786e8..ffc3d4649d4252b803c52df158398e61ef145f34 100644
--- a/dlls/wmiutils/tests/path.c
+++ b/dlls/wmiutils/tests/path.c
@@ -161,6 +161,11 @@ static void test_IWbemPath_SetText(void)
 
 static void test_IWbemPath_GetText(void)
 {
+    static const WCHAR serviceW[] =
+        {'W','i','n','3','2','_','S','e','r','v','i','c','e','.','N','a','m','e','=',
+         '\"','S','e','r','v','i','c','e','\"',0};
+    static const WCHAR classW[] =
+        {'W','i','n','3','2','_','C','l','a','s','s',0};
     static const WCHAR expected1W[] =
         {'r','o','o','t','\\','c','i','m','v','2',':','W','i','n','3','2','_',
          'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','d','=',
@@ -328,6 +333,32 @@ static void test_IWbemPath_GetText(void)
     hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path20 );
     ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
 
+    IWbemPath_Release( path );
+    if (!(path = create_path())) return;
+
+    hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, serviceW );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    len = sizeof(buf)/sizeof(buf[0]);
+    memset( buf, 0x55, sizeof(buf) );
+    hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
+    ok( hr == S_OK, "got %08x\n", hr );
+    ok( !lstrcmpW( buf, serviceW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
+    ok( len == lstrlenW( serviceW ) + 1, "unexpected length %u\n", len );
+
+    IWbemPath_Release( path );
+    if (!(path = create_path())) return;
+
+    hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, classW );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    len = sizeof(buf)/sizeof(buf[0]);
+    memset( buf, 0x55, sizeof(buf) );
+    hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
+    ok( hr == S_OK, "got %08x\n", hr );
+    ok( !lstrcmpW( buf, classW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
+    ok( len == lstrlenW( classW ) + 1, "unexpected length %u\n", len );
+
     IWbemPath_Release( path );
 }