Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all 15028 articles
Browse latest View live

Detect EFI or BIOS with powershell

$
0
0

Is there any way to detect whether a machine is UEFI or BIOS with a powershell script (without using third party tools)?

I would like to use this in a Dism script to apply images and build disk partitions based on the type of machine.


Yeah Buddy!


Detect if system is UEFI/EFI capable

$
0
0

Ok I feel like this shouldn't be such a difficult thing to find, but all my research only turns up answers on how to check if you are currently using UEFI. I can determine whether it is being used. What I need to know is what system were incorrectly set to use Legacy BIOS but can be reconfigured to UEFI.

Is this possible?

Need Help with a powershell script for DCs, DNS, DHCP and WINS servers in a domain

$
0
0

Hi all, 

I am looking for a script which can give me all the domain controllers, DNS servers, DHCP servers and WINS servers in a domain in a excel sheet with their location in the domain. 

thanks in advance

Regex and tilde

$
0
0

Greetings,

  Came across this the today which I cannot explain:

'xx,yy' -notmatch '^[~0-9a-zA-Z _\(\)-]+$' returns true whereas

'xx,yy' -notmatch '^[0-9a-zA-Z _\(\)-~]+$' returns false

All I did was move the tilde from the beginning to the end of the list of chars.

Cheers

David Z

List all Active & Disconnected sessions with usernames

$
0
0

Hi,

I am looking to find a way to find all Active & Disconnected sessions on all Windows servers in our Domain, we have about 800+ windows servers. And it's not practically possible to go to each server and run "qwinsta" command.

Below is the script i am using, but this is giving only the Active sessions, i am looking to show Disconnected sessions also. Any help on achieving is really appreciated. 

# Import the Active Directory module for the Get-ADComputer CmdLet 
Import-Module ActiveDirectory 
 
# Get today's date for the report 
$today = Get-Date 
 
# Setup email parameters 
$subject = "SERVER SESSIONS REPORT - " + $today 
$priority = "Normal" 
$smtpServer = "YourMailServer" 
$emailFrom = "email@yourdomain.com" 
$emailTo = "email@yourdomain.com" 
 
# Create a fresh variable to collect the results. You can use this to output as desired 
$SessionList = "SERVER SESSIONS REPORT - " + $today + "`n`n" 
 
# Query Active Directory for computers running a Server operating system 
$Servers = Get-ADComputer -Filter {OperatingSystem -like "*server*"} 
 
# Loop through the list to query each server for login sessions 
ForEach ($Server in $Servers) { 
    $ServerName = $Server.Name 
 
    # When running interactively, uncomment the Write-Host line below to show which server is being queried 
    # Write-Host "Querying $ServerName" 
 
    # Run the qwinsta.exe and parse the output 
    $queryResults = (qwinsta /server:$ServerName | foreach { (($_.trim() -replace "\s+",","))} | ConvertFrom-Csv)  
     
    # Pull the session information from each instance 
    ForEach ($queryResult in $queryResults) { 
        $RDPUser = $queryResult.USERNAME 
        $sessionType = $queryResult.SESSIONNAME 
         
        # We only want to display where a "person" is logged in. Otherwise unused sessions show up as USERNAME as a number 
        If (($RDPUser -match "[a-z]") -and ($RDPUser -ne $NULL)) {  
            # When running interactively, uncomment the Write-Host line below to show the output to screen 
            # Write-Host $ServerName logged in by $RDPUser on $sessionType 
            $SessionList = $SessionList + "`n`n" + $ServerName + " logged in by " + $RDPUser + " on " + $sessionType 
        } 
    } 

 
# Send the report email 
Send-MailMessage -To $emailTo -Subject $subject -Body $SessionList -SmtpServer $smtpServer -From $emailFrom -Priority $priority 
 
# When running interactively, uncomment the Write-Host line below to see the full list on screen 
$SessionList
$SessionList >> session.csv

vbs > exe getting an error

$
0
0

hi, i tried to make exe file with instruction from link below

https://social.technet.microsoft.com/Forums/scriptcenter/en-US/c0e7575a-6983-453b-8959-c6d889ccc01f/stepbystep-to-wrap-a-vbs-into-an-exe?forum=ITCG

Unfortunately i am getting error "Command line option syntax error. Type Command /? for Help."

This vbs can add attachment automatically to new Outlook message when you drag and drop file on it

Option Explicit
Dim objArgs, OutApp, oNameSpace, oInbox, oEmailItem, olMailItem
Dim a, oAttachments, subjectStr, olFormatHTML
olMailItem = 0
olFormatHTML = 2
Set objArgs = WScript.Arguments 'gets paths of selected files
Set OutApp = CreateObject("Outlook.Application") 'opens Outlook
Set oEmailItem = OutApp.CreateItem(olMailItem) 'opens new email
oEmailItem.To = ""
oEmailItem.cc = ""
oEmailItem.bcc = ""
For a = 0 to objArgs.Count - 1
Set oAttachments = oEmailItem.Attachments.Add(objArgs(a))
subjectStr = subjectStr & Right(objArgs(a),Len(objArgs(a))-       (InStrRev(objArgs(a),"\"))) & ", " 'recreates the default Subject e.g. Emailing: file1.doc, file2.xls
Next
If subjectStr = "" then subjectStr = "No Subject "
oEmailItem.Subject = ""
oEmailItem.BodyFormat = olFormatHTML
oEmailItem.Display

Can someone show me where is the problem with that error message?

Trying to retire an old, troublesome process that uses an Apple Script

$
0
0

Hey everyone;

I am new here as obviously I am at my wits end with this old antiquated process that we have at one of our locations.  Basically an applescript runs against a folder.  This process breaks constantly as 1. It probably wasn't created very well from the start and 2. It is on an old apple mini server that I desperately want to get rid of and move the entire process over to a windows machine.

Is there anyone out there that has any experience or any suggestions with how I can get off of this unsupported applescript?

Intune - Get Users/Devices that have specific software

$
0
0

hi all,

looking to get a list or users OR devices that have a specific software. i see that there is a discovered apps section in Intune, but that can only be viewed once you have selected the device. was looking at different methods (even graph API), and no luck.

Has anyone have any suggestions or was able to achieve this (whether its a direct method or having to manipulate outputted csvs, etc.)

at a loss here, but need this asap..been trying all day

Note: all devices are AAD enrolled, (not joined to a domain)


Powershell: Using results from drop down box as a variable

$
0
0

I need to get the results of the first DROPDOWN box stored as a variable, and used in place of INSTANCE_NAME in the second DROPDOWN box.

Essentially, the SELECT query from the second box needs to be run against the MASTER database in the SLQ_INSTANCE that the first DROPDOWN box results in once a choice has been made.

I’ve tried a few variations and can’t seem to get it right. Any suggestions?

Thanks in advance!

#first DROPDOWN Box
$label = New-Object System.Windows.Forms.Label
$label.Location = New-Object System.Drawing.Point(10,20)
$label.Size = New-Object System.Drawing.Size(280,20)
$label.Text = 'SQL Server Name'
$form.Controls.Add($label)
$DropDownBox = New-Object System.Windows.Forms.ComboBox
$DropDownBox.Location = New-Object System.Drawing.Size(10,40)
$DropDownBox.Size = New-Object System.Drawing.Size(260,20)
$DropDownBox.DropDownHeight = 200
$Form.Controls.Add($DropDownBox)
$wksList= invoke-sqlcmd -query "select * from VIEW_NAME
order by instance_name" -database DATABASE_NAME -serverinstance INSTANCE_NAME
foreach ($wks in $wksList) {                      $DropDownBox.Items.Add($wks.Instance_Name)                              } #end foreach
#end first DROPDOWN box
#second DROPDOWN Box
$label2 = New-Object System.Windows.Forms.Label
$label2.Location = New-Object System.Drawing.Point(10,90)
$label2.Size = New-Object System.Drawing.Size(280,20)
$label2.Text = 'Database Name'
$form.Controls.Add($label2)
$DropDownBox2 = New-Object System.Windows.Forms.ComboBox
$DropDownBox2.Location = New-Object System.Drawing.Size(10,110)
$DropDownBox2.Size = New-Object System.Drawing.Size(260,20)
$DropDownBox2.DropDownHeight = 200
$Form.Controls.Add($DropDownBox2)
$wksList2= invoke-sqlcmd -query "select name from sys.databases
where database_id>4
order by name" -database MASTER -serverinstance INSTANCE_NAME
foreach ($wks in $wksList2) {                     $DropDownBox2.Items.Add($wks.name)                            } #end foreach
#end second DROPDOWN box

how to delete saved VM state the scripted way

$
0
0

Hi there,

I exported five Hyper-V VMs for importing them onto other servers. I was trying to import them with a script, but none of them successfully imported, cause they were in saved state - and the new servers are having other processor features. So I have to delete the saved state.

It's no problem to do so in the Hyper-V GUI, if you do an import, you are getting an incompatibility report with a command box to delete the saved state - then click OK and the VM is imported.

Unfortunately I couldn't find a way to do that in a powershell script. I found the cmdlet "remove-vmsavedstate", but that cmdlet want's a VM, that already exists in Hyper-V management.

I found the "compare-vm", which is showing me, that the VM I'm trying to import has incompatibilities.

But I found no way to resolve these incompatibilities ( delete saved state ) the scripted way with a VM that is only existing as export on disk.

Any ideas?

Yours Franz-Georg


fgc

filter air industri

$
0
0

MASTER WATER SOLUTION adalah SOLUSI untuk masalah air yang kotor, berbau, bercak putih, flek kuning, zat besi tinggi, mangan, kuning organic. "untuk masalah air apapun SEGERA HUBUNGI kami.."

filter air ?

Penjernih Air ?

Penyaring Air ?

filter air industri ?

Penyaring Air Industri ?

Penyaring Air Industri ?

Deleted

Powershell Ping script required for multiple Server IP Add, want to run from Task scheduler every one hour

$
0
0
if the server pinging good, we want email subject like "192.168.2.222 is pinging ok",  if it is not ping email subject like "192.168.2.222 is pinging not ok " . we want to run this script from Task scheduler in every one hour. OS Windows 10, 2012 server

Powershell - filter an array

$
0
0

Hi all,

I am trying to filter an array in power shell for elements which contain a specific pattern.

I used this command to do so,

$raw_data | where-object -Property ColumnName -EQ 'Pattern%'

and I am getting no results, can anyone help? 

Thanks in advance!

Mike


Mike

+⑨①-8094945424~@~Mantra to remove problem in dubai america


-join $null value to Powershell script

$
0
0

Hello,

Using Powershell, I've constructed the following:

-join (($var1 +$var2+$var3|%{[char]$_})+$var4 | Get-Random)

I need some of the variables to disappear from time to time.

If I add

$var1 = $null
and try to loop it back to the -join statement, I get an error. Is there a way to have the variables disappear some other way?

What is wrong with My Powershell command, wild cards not working?

$
0
0

Hi

I'm doing a build and capture in MDT I'd like to slip in a custom Windows 10 start menu for the Administrator account.

In order to do this i am trying to run the following powershell to delete a certain regkey that is preceded by a unique sid.

Remove-Item 'HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\*$start.tilegrid$windows.data.curatedtilecollection.tilecollection' -Force -Recurse Get-Process Explorer | Stop-Process

So my question is how do I automate the deletion of this regkey?

Disable to Open particular(delegated) Another Mailbox from OWA

$
0
0

Hello,

the below commands can be used to Disable the Open Another Mailbox from OWA

New-OwaMailboxPolicy -Name “DisableOpenAnotherMailbox”

Set-OwaMailboxPolicy “DisableOpenAnotherMailbox” –ExplicitLogonEnabled $false

But is there a command I can use to Disable the Open Another Mailbox from OWA only in case the users try to access a specific MB from OWA(that they might have delegation access on)

The Goal here is to make sue that no one can open specific mailbox from Owa except it's owner

Thanks

Batch file for checking port status of multiple IP Address

$
0
0
How to check the port status of multiple IP Addresses from windows command prompt. I am looking for some Batch file or a Dos SCRIPT

Separate Directory Address list for Student-Office365

$
0
0

Hi,

I've the two department in my Org student and teachers and i want disable the Teachers ID to be searched by Student  from address list, please help somebody to how to get this done in office365.

Thank you

Viewing all 15028 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>