Update file contents based on filename
Hi, I am trying to create a script that will achieve the following: Get a filename, and then update the first 11 characters of the file based on filename. I have 5 text files. TEXT1, TEXT2, TEXT3,...
View ArticlePowershell results to a specified table
Hi,How to get a all disk information including mount points servername, Diskname,Filesystem,Capacity, %free from a list of servers and write all the the information to a specific SQL database table
View ArticleRun Powershell script as Scheduled task, that uses Excel COM object
What am I missing here.. I have Powershell script that uses the Quest AD cmdlets to get computer information from AD and populate an Excel spreadsheet with the data.The script works fine, so I created...
View Articlecan't pass a file's LastWriteDate to a function
I just want to pass a file's LastWriteDate to a function. I've tried two different ways. Passing the whole file's info and just passing the file's LastWriteDate,, as shown by my two different...
View ArticleDumping data into a SQL DB
Hi All,We currently use powershell (to call LogParser) to extract data from CSV files and put them them in another CSV file after it has been manupilated. We now have a need to get the data which are...
View ArticleError when running Get-ADAccountAuthorizationGroup cmdlet
I am trying to retrieve a list of all the groups a user is a member of. I ran the command:Get-ADAccountAuthorizationGroup username and received this error:The server has returned a no matching security...
View ArticlePowershell - Parse Data Returned from Web Request
$result = Invoke-WebRequest http://partsurfer.hp.com/Search.aspx?SearchText=614988-B21Now, I want to grab two lines in the output that looks like:Product Number : 614988-B21 Description : HP SCO8E 6 GB...
View ArticleSuggestion of Assignment
I'm newbie and started learning about PowerShell. Gonna need some assignment to improve my skills in PowerShell. Do you have one or many suggestion of assignment that I can do? By doing assigment it...
View ArticleCertificate Expiration checking
$CSV = Import-Csv C:\scripts\Servers.csv $CSV | ForEach { write-output $_.ServerList #Number of days to look for expiring certificates $threshold = 120 #Set deadline date $deadline =...
View ArticleDelete AD accounts in a dev domain that don't exist in a production domain
It has been decided by management that our dev domain needs to be cleaned up and I was "volunteered" for that task. I’m going to start off with admin level user accounts first; if an admin user doesn’t...
View ArticleRe : Powershell does NOT return errorcode to CMD file thats invoking PS
Hello there,I am trying to return the exit code from PS back to CMD file that invokes the PS. Funny thing is PS does print exit code as 1 but CMD files still shows errorlevel as 0..... not sure what is...
View ArticlePowershell - Remove unwanted characters in a line of text
$result = invoke-webrequest http://partsurfer.hp.com/Search.aspx?SearchText=614988-B21 $line = $result.allelements | where-object {$_.innerhtml -like "*:*"} | sort-object { $_.innerhtml.length } |...
View ArticleCreate SQL Job with Invoke-Sqlcmd
I'm trying to run a set of .sql files, i didn't know how to pass a common variable to all, so i've started running the statements directly in ps. One of these creates a job but i'm running into all of...
View ArticleAD-PrincipalGroupMembership output to File
I have a short snippit that I use to write an AD Users's groups to a Text file. The output I get is a text file with spaces behind the data. Attached is a screenshot, the blue highlighted space is the...
View ArticleTrouble adding leading zeros to numbers in PowerShell script
I am new to PowerShell scripting (so have mercy on me please!), and I'm trying to write a script that takes simplified, menu-based user input to create a folder on the network named based on a month...
View ArticleWhile loop hangs in my script
Hi guys,I want to check if SCCM (install windows image) is ready.If it's not, than it has to sleep. I want this in a while loop because when it takes longer, it must loop another5 minutes.When the...
View ArticleParse local HTML files
Hi,I want to parse local HTML files. Is there another way than using the Internet Explorer($ie = new-object -com "InternetExplorer.Application";) (without relaying on external packages)?At the moment I...
View ArticleGet AD group membership of the local computer
HiHow do I list all the groups the current computer account is a member of?I can do it for the user:([System.Security.Principal.WindowsIdentity]::GetCurrent()).Groups | Foreach-Object {...
View ArticlePowershell 4.0 How to use Add-Printer to add printer for all users (machine)
Is there a way I can use Powershell 4.0 Add-Printer cmdlet to add a printer for all users (machine)? I tried from an admin account but it only adds a printer for the currently logged on user.thanks.
View Article