changing ip address remotely causes disconnection
when i try to run this and change the ip address of a machine remotely, it disconnects before I can change the ip gateway. how can i get this working without getting disconnected?$wmi = Get-WmiObject...
View ArticlePass SQL Query to Powershell Variables in an Array
Hi,My Question is so simple maybe but anyway i am stuck hereI want to run a sql query and write down the results in a table and email it to peoplebut i am in first phase now, i.e. getting sql query...
View ArticleWhat does %{} actually do?
What does %{} actually do, for example, in the following script?Get-Mailbox -Resultsize Unlimited | Get-MailboxStatistics | %{$_.TotalItemSize.Value.ToMB()} | Measure-Object –AverageThanks,Kevin
View ArticleScript to locate if systems has a TPM chip and it's status if it does.
I am looking for a script that would scan AD for a list of computers and then query them to see if they have a TPM chip and then what the status of each one is.I have been looking around and so far...
View ArticleAcessing WQL query results
Hi,I'm wanting to output 2 properties retrieved from a WQL query against an SCCM site. If I run a query against only one WMI class, I'm then able to display the properties from the resulting object in...
View ArticleRobocopy - Move Files/Folders and retain time/date
I am helping a department creaning their data - they have around 2TB.I have made a copy of all the data (Zero length files) to a folder - this way i can do some test runs of the scripts. The next thing...
View ArticleAdding time on a FileName and move the file
Hi I have a Problem with adding a time to a filename and move it then.Here is what I'm doing:$currentTime=(Get-Date -Format T) $currentFile=($currentSam+$currentTime+".htm") Rename-Item $fileName...
View ArticlePowershell Variables Query
OK,So i have a path and would like all the folders/directories that are in that path to be set as variables.This gives me the list i want... now how can i pass each of the lines after ---- to...
View ArticleChange Bitlocker Pin without user interaction
I need to change the bitlocker PIN on our Windows 7 systems, without requiring any interaction from the user. I was surprised to find that you can't pass the PIN as a parameter to manage-bde. Can...
View ArticleUsing PowerEvents to capture Permanent WMI Events for SQL Server Blocking
I've been enthusiastically educating myself on PowerShell and how it can be used to monitor SQL Server and in the process discovered Trevor Sullivan's fantastic PowerEvents modules (thanks to a...
View ArticleVBScript to list one perticular service of all WMI enabled computers
Hi,Please suggest a VBscript which can list any particular service of multiple servers.Example: If I want to list the status of "Net Logon" of computer1, computer2, computer3.Regards,PranayPranay...
View ArticleHow can I used Error Trapping / Error Action with .NET type
HelloI wounder if someone can help me with the following question please.If I do the following[System.IO.Directory]::EnumerateFiles("\\Server1\Directory1","*.ps1",AllDirectories)I get a list of files...
View ArticleGet-mailboxstatistics and Quota details
Hi all,I have the below script to get info from all mailboxes with the quota details, but in the report.csv file i don't have quota details like you can see in the example below:get-mailbox -server...
View ArticlePowershell Script to add managed service accounts Errors out
Trying to create a script to create a bunch of managed service accoutns at once from a csv file. the script is pretty basic:# import the AD module if (-not (Get-Module ActiveDirectory)) {Import-Module...
View ArticleDateTime parameters with non-US formats
I would like to write a PowerShell script that accepts parameters that represent given dates and times (they will be used to specify a time range to search within). I thought I could use the [DateTime]...
View ArticleGet-VM state question
Hey all, quick question...Im sure its a simple solution that i am overlooking, any how below is something I started. The main goal of this script is just to monitor a specific Hyper-V VM and when its...
View ArticlePrinting with InternetExplorer.Application / ExecWB OLECMDID_PRINT on Windows...
On Windows 2008 and Windows 2008 R2 it was possible to start a VB-Script from a service process, create the InternetExplorer object and print a HTML file by calling ExecWB with the OLECMDID_PRINT...
View ArticleEmbed a background image in a html code sent via powershell
Hi,maybe not important but i need this :Di have written a HTML code full of tables, tags, css styles, variables and ... which is inserted into a powershell script to be used as the body of an email and...
View ArticleBatch file or VB Script to Run SECEDIT Command to Enable Audit of Failure...
Hi,Can anyone suggest any VBS or BAT file to Enable Audit of Failure Event for Multiple computer? I have to enable Audit of Failure Events on %SystemDrive%.As of now, I can do it for single machine by...
View ArticleStop-TSSession
I'm trying to write a script that'll find all TS sessions our administrators have disconnected from and kill them. But I can't seem to get stop-tssession to work properly. Am I missing something...
View Article