Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7800017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:29:47+00:00 2026-06-02T00:29:47+00:00

I started putting this PowerShell Script together, the hope would be to replace some

  • 0

I started putting this PowerShell Script together, the hope would be to replace some tasks that are currently carried out manually

I’m using the

get-Date.AddDays()

function

I’m using the ISE to build the script and in testing I get output if I single out the ‘starttime’ property, but this seems to be a catch all because the values all come up null, ideally I’d like to use the ‘timesubmitted’ property, but the date seems to output in an odd that I don’t think is being read correctly because my queries with ‘timesubmitted’ always come up empty

it comes out in this format, if you do an open query

20120416030836.778000-420

here’s what I have so far.

disregard the | ‘format-table’ function that’s just so I can see if I’m getting the desired output

#Clears Old Print Jobs on Specified server

#Sets Execution Policy for Script to run
Set-ExecutionPolicy RemoteSigned -Force

#establishes variable for cutoff date
$d = Get-Date
$old = $d.AddDays(-4)

#Queries WMI and retrieves print jobs
Get-WmiObject -class win32_printjob -namespace "root\CIMV2" | where-object {$_.timesubmitted -lt
"$old"} | ft caption,document,jobid,jobstatus,owner,timesubmitted
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:29:48+00:00Added an answer on June 2, 2026 at 12:29 am

    In PowerShell every WMI instance has a ScriptMethod that you can use to convert the dates from WMI format to .NET format:

    Get-WmiObject Win32_PrintJob | 
    Where-Object { $_.ConvertToDateTime($_.TimeSubmitted) -lt $old } |
    Foreach-Object { $_.Delete() }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm putting together a web site that needed to include some signup and blogging
I've just started learning Spring (and Java) and I'm putting together an application that
Started working on a new application this week that is running the latest rails
I have a search form that can search in different provider. I started out
I just started writing pub/sub and the way that I doing this is that
I am aware of this tutorials http://wix.tramontana.co.hu/tutorial/getting-started/putting-it-to-use http://www.codeproject.com/KB/install/WixTutorial.aspx ... but I can't find a
I have this project that recently started crashing on beta builds of Windows 7.
I started a new project this morning and, after putting ~3 hours of work
I'm writing a MVVM app and have started putting in a few animations. I
Started with this question: OpenID. How do you logout OK. So OpenID does not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.