# This Powershell script just creates a new, empty Word document and saves it. # Potentially useful for batch operations or for getting started on # a more complex script. # Create an instance of Word the script will work with $objWord = New-Object -comobject Word.Application # Set Word to be visible on screen. # This can also be set to $False to make Word not appear # on screen but just run in the background. $objWord.Visible = $True # Now create a new empty document. $objDoc = $objWord.Documents.Add() # Steps to add content to the document will go here. # For now we're just saving a new, blank document. # Assign a static file name and path to a variable. $filename = "C:\scripts\temp.docx" # Save the Word document using the variable we just created. $objDoc.SaveAs([REF]$filename) # This step will print the document to the default # printer using its default settings. # Uncomment the line if you want the document to print. #$objDoc.PrintOut() # Close the document. $objDoc.Close() # Quit Word. $objWord.Quit()