Link to home
Start Free TrialLog in
Avatar of abdullah eideh
abdullah eideh

asked on

There is no script engine for file extension ".vbs

when i execute script , file profile_delete.txt created and this error appear on it " There is no script engine for file extension ".vbs java "
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

There is not nearly enough info to help you there. What are you doing and how?
Avatar of abdullah eideh
abdullah eideh

ASKER

What was the exact command you used? Did it definitely have a valid server name at the end of it?
run  delete_all_profiles.bat
i am sure about servername
Hang on - what does (did) profile_delete.txt contain exactly?
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Input Error: There is no script engine for file extension ".vbs Java".
So how can you possibly use that file as the basis for further processing? You need to find out why it's filled with an error instead of the proper content
delete_all_profiles.bat file contain this line
cscript.exe "D:\Scripts\delete_profiles.vbs servername" > "D:\Scripts\profile_delete.txt"


delete_profiles.vbs file contain
On Error Resume Next

args = WScript.Arguments.Count

If args <> 1 Then
  WScript.Echo "usage: delete_profiles SVRNAME"
  WScript.Echo "example (for remote profiles): cscript.exe delete_profiles SOMESERVER  "
  WScript.Echo "example (for local profiles): cscript.exe delete_profiles .  "
  WScript.Quit
End If

strComputer = WScript.Arguments.Item(0)
Set objWMIService = GetObject("winmgmts:\\" & strComputer &"\root\cimv2")
Set colProfiles = objWMIService.ExecQuery("Select * from Win32_UserProfile")
Wscript.Echo "==" & WScript.Arguments.Item(0) & "==" & vbNewLine

For Each objProfile in colProfiles
  Set objSID = objWMIService.Get("Win32_SID.SID='" & objProfile.SID &"'")
      If (objSID.ReferencedDomainName = "Domainname") Then
      If Not ((objSID.AccountName = "administrator TO EXCLUDE") Or (Left (objSID.AccountName,2) = "administrator")) Then
          Set objUserProfile = GetObject("winmgmts:{impersonationlevel=impersonate}!\\" _
        & strComputer &"\root\cimv2:Win32_UserProfile." _
          &"SID='" & objProfile.Sid &"'")
          objUserProfile.Delete_
     Wscript.Echo objSID.AccountName & ";" & objSID.ReferencedDomainName & ";" & objProfile.LocalPath & " - " & "DELETED"
     End If
End If
Next
delete_all_profiles.bat file contain this line
cscript.exe "D:\Scripts\delete_profiles.vbs servername" > "D:\Scripts\profile_delete.txt"
So, your server name is actually 'servername'?
i replace servername with server which i run script on it , and replace domainname with domain witch server join to it
I'm sorry but i'm not willing to continue with this unless you state the actual literal values in your file(s)
It's wasting my time as there's too much room for error
delete_all_profiles.bat file contain this line
cscript.exe "D:\Scripts\delete_profiles.vbs javam" > "D:\Scripts\profile_delete.txt"


delete_profiles.vbs file contain
On Error Resume Next

args = WScript.Arguments.Count

If args <> 1 Then
  WScript.Echo "usage: delete_profiles SVRNAME"
  WScript.Echo "example (for remote profiles): cscript.exe delete_profiles SOMESERVER  "
  WScript.Echo "example (for local profiles): cscript.exe delete_profiles .  "
  WScript.Quit
End If

strComputer = WScript.Arguments.Item(0)
Set objWMIService = GetObject("winmgmts:\\" & strComputer &"\root\cimv2")
Set colProfiles = objWMIService.ExecQuery("Select * from Win32_UserProfile")
Wscript.Echo "==" & WScript.Arguments.Item(0) & "==" & vbNewLine

For Each objProfile in colProfiles
  Set objSID = objWMIService.Get("Win32_SID.SID='" & objProfile.SID &"'")
      If (objSID.ReferencedDomainName = "manGoPol.com") Then
      If Not ((objSID.AccountName = "administrator TO EXCLUDE") Or (Left (objSID.AccountName,2) = "administrator")) Then
          Set objUserProfile = GetObject("winmgmts:{impersonationlevel=impersonate}!\\" _
        & strComputer &"\root\cimv2:Win32_UserProfile." _
          &"SID='" & objProfile.Sid &"'")
          objUserProfile.Delete_
     Wscript.Echo objSID.AccountName & ";" & objSID.ReferencedDomainName & ";" & objProfile.LocalPath & " - " & "DELETED"
     End If
End If
Next
Not going to work - the second file contains placeholders instead of real values
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.