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 "
There is not nearly enough info to help you there. What are you doing and how?
ASKER
What was the exact command you used? Did it definitely have a valid server name at the end of it?
ASKER
run delete_all_profiles.bat
i am sure about servername
i am sure about servername
Hang on - what does (did) profile_delete.txt contain exactly?
ASKER
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".
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_profile s.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("S elect * from Win32_UserProfile")
Wscript.Echo "==" & WScript.Arguments.Item(0) & "==" & vbNewLine
For Each objProfile in colProfiles
Set objSID = objWMIService.Get("Win32_S ID.SID='" & objProfile.SID &"'")
If (objSID.ReferencedDomainNa me = "Domainname") Then
If Not ((objSID.AccountName = "administrator TO EXCLUDE") Or (Left (objSID.AccountName,2) = "administrator")) Then
Set objUserProfile = GetObject("winmgmts:{imper sonationle vel=impers onate}!\\" _
& strComputer &"\root\cimv2:Win32_UserPr ofile." _
&"SID='" & objProfile.Sid &"'")
objUserProfile.Delete_
Wscript.Echo objSID.AccountName & ";" & objSID.ReferencedDomainNam e & ";" & objProfile.LocalPath & " - " & "DELETED"
End If
End If
Next
cscript.exe "D:\Scripts\delete_profile
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("S
Wscript.Echo "==" & WScript.Arguments.Item(0) & "==" & vbNewLine
For Each objProfile in colProfiles
Set objSID = objWMIService.Get("Win32_S
If (objSID.ReferencedDomainNa
If Not ((objSID.AccountName = "administrator TO EXCLUDE") Or (Left (objSID.AccountName,2) = "administrator")) Then
Set objUserProfile = GetObject("winmgmts:{imper
& strComputer &"\root\cimv2:Win32_UserPr
&"SID='" & objProfile.Sid &"'")
objUserProfile.Delete_
Wscript.Echo objSID.AccountName & ";" & objSID.ReferencedDomainNam
End If
End If
Next
delete_all_profiles.bat file contain this lineSo, your server name is actually 'servername'?
cscript.exe "D:\Scripts\delete_profiles.vbs servername" > "D:\Scripts\profile_delete .txt"
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
It's wasting my time as there's too much room for error
ASKER
delete_all_profiles.bat file contain this line
cscript.exe "D:\Scripts\delete_profile s.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("S elect * from Win32_UserProfile")
Wscript.Echo "==" & WScript.Arguments.Item(0) & "==" & vbNewLine
For Each objProfile in colProfiles
Set objSID = objWMIService.Get("Win32_S ID.SID='" & objProfile.SID &"'")
If (objSID.ReferencedDomainNa me = "manGoPol.com") Then
If Not ((objSID.AccountName = "administrator TO EXCLUDE") Or (Left (objSID.AccountName,2) = "administrator")) Then
Set objUserProfile = GetObject("winmgmts:{imper sonationle vel=impers onate}!\\" _
& strComputer &"\root\cimv2:Win32_UserPr ofile." _
&"SID='" & objProfile.Sid &"'")
objUserProfile.Delete_
Wscript.Echo objSID.AccountName & ";" & objSID.ReferencedDomainNam e & ";" & objProfile.LocalPath & " - " & "DELETED"
End If
End If
Next
cscript.exe "D:\Scripts\delete_profile
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("S
Wscript.Echo "==" & WScript.Arguments.Item(0) & "==" & vbNewLine
For Each objProfile in colProfiles
Set objSID = objWMIService.Get("Win32_S
If (objSID.ReferencedDomainNa
If Not ((objSID.AccountName = "administrator TO EXCLUDE") Or (Left (objSID.AccountName,2) = "administrator")) Then
Set objUserProfile = GetObject("winmgmts:{imper
& strComputer &"\root\cimv2:Win32_UserPr
&"SID='" & objProfile.Sid &"'")
objUserProfile.Delete_
Wscript.Echo objSID.AccountName & ";" & objSID.ReferencedDomainNam
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 TRIALMembers 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.