Re: WMI script
- From: "Miyahn" <HQF03250@xxxxxxxxxxx>
- Date: Tue, 24 Jan 2006 07:07:28 +0900
"Costa" wrote in message news:AA318C77-005F-4B6A-A602-7E2C14BD5DD9@xxxxxxxxxxxxx
> Hello
>
> Is there a difference between WMI on XP and win2k?
>
> I created the following script that runs fine on winxp but gives me the
> following error below on win2k sp4
>
> =================
> Line:12
> Char:1
> Error: 0x80041017
> Code: 80041017
> Source: (null)
> ===================
>
> Here is the script, I want to delete all word docs in all subdirectories
> that start with "P" older than 61 days. ( i know i'm just echoing in this
> script, its for testing)
>
> =================================
> strDate = Date()-61
>
> strComputer = "."
> Set objWMIService = GetObject _
> ("winmgmts:\\" & strComputer & "\root\cimv2")
> Set colFiles = objWMIService.ExecQuery _
> ("Select * From CIM_DataFile Where LastModified < '" & strDate & "'" & _
> " AND Extension = 'doc' "& _
> " AND Drive = 'D:'"& _
> " AND Path Like '\\elite\\%'"& _
> " AND FileName LIKE 'p%'")
> For Each objFile In colFiles
> Wscript.Echo objFile.Name
> Next
> ==========================================
>
> Does anyone have any ideas why it doesnt work on win2k?
>
> Thanks
In WQL, the LIKE operator is available on Microsoft Windows XP and
Windows Server 2003.
Use FileSystemObject to delete specified files instead.
--
Miyahn (Masataka Miyashita) JPN
Microsoft MVP for Microsoft Office - Excel(Jan 2006 - Dec 2006)
HQF03250@xxxxxxxxxxx
.
- Prev by Date: Re: WSH detail problem
- Next by Date: Re: Enumerating Share Permissions with WSH/ADSI/WMI?
- Previous by thread: Re: Run RunAs Silently
- Next by thread: Re: Enumerating Share Permissions with WSH/ADSI/WMI?
- Index(es):
Loading